So I have this code here in a config file
pickupLocations = { -- All the objects to be spawned inside of the warehouse
[1] = vector3(1003.62, -3091.69, -39.0),
[2] = vector3(1010.83, -3097.02, -39.0),
[3] = vector3(1003.7, -3097.15, -39.0),
[4] = vector3(1006.13, -3091.76, -39.0),
[5] = vector3(1008.44, -3091.57, -39.0)
}
and then this code in a client file
for _, spawnLoc in pairs(WarehouseData.pickupLocations) do
local randObj = WarehouseData.listOfObjects[math.random(1, #WarehouseData.listOfObjects)]
RequestModel(randObj)
while not HasModelLoaded(randObj) do -- Not sure if I actually need this
Citizen.Wait(1000)
end
local pickupObj = CreateObject(randObj, spawnLoc.x, spawnLoc.y, spawnLoc.z)
FreezeEntityPosition(pickupObj, true)
PlaceObjectOnGroundProperly(pickupObj)
table.insert(objects, pickupObj)
end
and for some reason when the script first loads when the server loads, the objects will be above the ground in the air sort of and if you were to re run the code (restarting script or anything that triggers that bit of code) they then get placed properly on the ground. How would I go about making it so that they dont keep spawning in the sky when the server first loads?