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
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).