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