Hey, made some code that spawns a PED model via QB-Target when the script starts. But ran into the problem that when there is server start it spawns 2 PED models inside each other. If you choose to restart the script afterwards, the script works fine, where it does not spawn 2 PED models. And the problem also is that I’m not getting any error in either the server console or F8 console, so I have a hard time finding the problem.
My code looks like this:
CreateThread(function()
exports['qb-target']:SpawnPed({
model = 's_m_m_prisguard_01',
coords = Config.TorbenLocation[math.random(1, #Config.TorbenLocation)],
minusOne = true,
freeze = true,
invincible = true,
blockevents = true,
target = {
useModel = false,
options = {
{
num = 1,
type = "client",
event = "qb-prison:client:ShopGuard",
icon = 'fa-solid fa-tally',
label = 'Snak med Torben',
canInteract = function(entity, distance, data)
if IsPedAPlayer(entity) then return false end
return true
end,
}
},
distance = 2.5,
},
currentpednumber = 0,
})
end)