Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 answer

I fixed it with a simple line of code:

settings().Studio.ScriptTimeoutLength = -1

This discussion is preserved as it was. New answers, comments, and votes are closed.