While true do works for some time but stops. Here is the code:
local Spawns = {} while true do for i,v in pairs(game.Workspace.Spawns:GetChildren()) do v.Name = v.Name..i table.insert(Spawns,v.Name) end local picked = Spawns[math.random(1,#Spawns)] local spawn1 = game.Workspace.Spawns:FindFirstChild(picked) local zombie = game.ReplicatedStorage.Zombie:Clone() zombie:SetPrimaryPartCFrame(CFrame.new(spawn1.Position+Vector3.new(0,3,0))) zombie.Parent = workspace wait(2) end
I fixed it with a simple line of code:
settings().Studio.ScriptTimeoutLength = -1