Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does while true do stop doing anything after some time?

Asked by 4 years ago

While true do works for some time but stops. Here is the code:

01local Spawns = {}
02 
03while true do
04    for i,v in pairs(game.Workspace.Spawns:GetChildren()) do
05        v.Name = v.Name..i
06        table.insert(Spawns,v.Name)
07    end
08 
09    local picked = Spawns[math.random(1,#Spawns)]
10    local spawn1 = game.Workspace.Spawns:FindFirstChild(picked)
11    local zombie = game.ReplicatedStorage.Zombie:Clone()
12    zombie:SetPrimaryPartCFrame(CFrame.new(spawn1.Position+Vector3.new(0,3,0)))
13    zombie.Parent = workspace  
14    wait(2)
15end

1 answer

Log in to vote
0
Answered by 4 years ago

I fixed it with a simple line of code:

1settings().Studio.ScriptTimeoutLength = -1
Ad

Answer this question