RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"00:14:24.755 Script timeout: exhausted allowed execution time - Server - ZombieScript:9"
-- It seems like the script is running into an infinite loop causing it to exceed the allowed execution time. To avoid this, you can add a wait() function inside the while loop to pause the script execution for a certain amount of time. Here's how you can modify the script: local spawns = script.Parent.Spawns local zombies = script.Parent.ZombieInstances local max_zombies = 50 local wave = 0 local num_zombies = 3 while true do for _, player in pairs(game:GetService("Players"):GetPlayers()) do if player:FindFirstChild("PlayerGui") then player.PlayerGui.IntermissionAndWave.Wave.Text = ''..wave end end if #zombies:GetChildren() == 0 then script.NewWave:Play() wave = wave + 1 if num_zombies <= max_zombies then num_zombies = num_zombies * wave end for _, spwn in pairs(spawns:GetChildren()) do if spwn:IsA('BasePart') then for i = 1, num_zombies do local zombieCopy = game.ReplicatedStorage.Zombies['Furry']:Clone() zombieCopy.Parent = zombies zombieCopy.HumanoidRootPart.CFrame = CFrame.new(spwn.Position + Vector3.new(0,3,0)) end end end end wait(1) -- add this line to pause the script for 1 second end