While true do works for some time but stops. Here is the code:
01 | local Spawns = { } |
02 |
03 | while 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 spawn 1 = game.Workspace.Spawns:FindFirstChild(picked) |
11 | local zombie = game.ReplicatedStorage.Zombie:Clone() |
12 | zombie:SetPrimaryPartCFrame(CFrame.new(spawn 1. Position+Vector 3. new( 0 , 3 , 0 ))) |
13 | zombie.Parent = workspace |
14 | wait( 2 ) |
15 | end |
I fixed it with a simple line of code:
1 | settings().Studio.ScriptTimeoutLength = - 1 |