Exhaustion allowed execution time

But there is a wait in that repeat line?

The script is also a While true loop, and that line is just part of the code that’s inside the loop.

I don’t know about this but try breaking the for loop?

Didn’t work, it timed out again.

That’d break my entire game. I need the while loop

settings().Studio.ScriptTimeoutLength = -1 -- Will stop exhaustion in scripts.

How to handle “Script timeout: exhausted allowed execution time” - Help and Feedback / Scripting Support - DevForum | Roblox

My studio is freezing forever. My studio crashed too.

I do not even know, try checking the link to the post I put in.

I did. But the posts following the solution were unrelated.

It’s maybe because you don’t have a wait() statement in your for loop.

1 Like

I don’t think that it is a maybe, im pretty sure that there’s no wait() in the script

nvm I found a wait in the script so isnt that

Try adding a wait() statement in your for i,v in pairs loop and your for count loop.

There are waits in the scripts.

maybe do repeat wait() would fix it

I found where the error is:

repeat
		wait(1)
		timer -= 1
		Status.Value = "Round starting in "..timer
	until timer == 0
	local PartToDelete

	for count = 1, #Map:GetChildren() do 
		timer = tonumber(#Map:GetChildren())
		timer -= 1
		Status.Value = "Round Time left: "..timer
		local ChildrenOfModel = Map:GetChildren()
		PartToDelete = ChildrenOfModel[math.random(#ChildrenOfModel)]

		if PartToDelete.Name == "LandPart" then 
			PartToDelete.Material = Enum.Material.Neon
			PartToDelete.BrickColor = BrickColor.new("Really red")
			wait(time_between_destroy)
			PartToDelete:Destroy()
		else
			repeat 
				PartToDelete = ChildrenOfModel[math.random(#ChildrenOfModel)] 
				if PartToDelete.Name == "LandPart" then 
					PartToDelete.Material = Enum.Material.Neon
					PartToDelete.BrickColor = BrickColor.new("Really red")
					wait(time_between_destroy)
					PartToDelete:Destroy()
				end
			until PartToDelete.Name == "LandPart" --Where the error is

In the repeat loop your only using a wait if the partname is landpart, so if you dont have landpart in the table itll just break the repeat until loop.

So where do I add a wait() in the repeat?

Instead of placing wait in the if parttodelete = “landpart” just put it outside. Sorry for the lackluster explanation i am on mobile but… You want to do something like

repeat
Wait(inserttimehere)
If partname == landpart then
End
Until partname == landpart

Or something and also have an or in there so the loop doesnt get stuck forever for some reason.

It froze again:

repeat
		wait(1)
		timer -= 1
		Status.Value = "Round starting in "..timer
	until timer == 0
	local PartToDelete

	for count = 1, #Map:GetChildren() do 
		timer = tonumber(#Map:GetChildren())
		timer -= 1
		Status.Value = "Round Time left: "..timer
		local ChildrenOfModel = Map:GetChildren()
		PartToDelete = ChildrenOfModel[math.random(#ChildrenOfModel)]
		wait(1)
		if PartToDelete.Name == "LandPart" then 
			PartToDelete.Material = Enum.Material.Neon
			PartToDelete.BrickColor = BrickColor.new("Really red")
			wait(time_between_destroy)
			PartToDelete:Destroy()
		else
			repeat 
				PartToDelete = ChildrenOfModel[math.random(#ChildrenOfModel)] 
				if PartToDelete.Name == "LandPart" then 
					PartToDelete.Material = Enum.Material.Neon
					PartToDelete.BrickColor = BrickColor.new("Really red")
					wait(time_between_destroy)
					PartToDelete:Destroy()
				end
			until PartToDelete.Name == "LandPart"