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

How to avoid "Script timeout: exhausted allowed execution time" ?

so i have this script which removes a folder with loathes of 2x2x2 cubes and like how to i make it avoid "Script timeout: exhausted allowed execution time" ?

here is the script :

script.Parent.MouseButton1Click:Connect(function()
	if game.Workspace:WaitForChild("blocks")then
		folder = game.Workspace:WaitForChild("blocks")
		folder:Destroy()
		newFolder = Instance.new("Folder", workspace)
		newFolder.Name = "blocks"
	else 
		newFolder = Instance.new("Folder", workspace)
		newFolder.Name = "blocks"
		
	end
	
	
	
end)

1 comment

0

Is there any over script that's running? That error usually occurs when someone has made a while loop without putting a wait in it (therefore crashing the game).

1 answer

✓ Accepted answer

It would be better if you posted some code but i'm just going to assume its a a loop. Have you tried putting wait() inside the loop itself?

4 comments

0

its not a loop just deletes the whole folder in one instance.

0

Would you mind posting the actual script?

0

done added the script

0

I would add a wait() towards the end of the code anyways since the error is basically saying the script is exhausted

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