I am making an invisible zombie spawner that covers the whole map and every 40 seconds, InsertService is being used to insert a zombie from the library and each zombie is given a debris timer. After 180 Seconds, the Zombie should despawn at that setted time.
There has been a problem where at random when a zombie gets spawned into the map, they could despawn anywhere from 5-200 Seconds. I don't know what could possibly be the problem with this false debris issue. Please help if you can.
local waitTime = 40 local assetId = 2669006038
while wait(waitTime) do local xSize = script.Parent.Size.X local ySize = script.Parent.Size.Y local zSize = script.Parent.Size.Z
local spawnPos = (script.Parent.CFrame * CFrame.new(math.random(-xSize/2,xSize/2),math.random(-ySize/2,ySize/2),math.random(-zSize/2,zSize/2))).p
local newZombie = game:GetService("InsertService"):LoadAsset(assetId) newZombie.Name = "RoboZombie" newZombie.Parent = game.Workspace newZombie:MoveTo(spawnPos) end