Did you check if object finished spawning?
Note: the official description of the property 'spawning' is misleading IMHO. It is true as long as the object did not finish spawning. I use this simple function to wait for the spawned object:
Code:
function waitSpawn(object)
--[[
object.spawning is true, as long as the object is spawning (which usually takes 50-100 ms), and false if spawned.
@param {object} object The object we are waiting to spawn.
--]]
while object.spawning do
coroutine.yield(0)
end
end