Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
OX_X4 2
4 years ago
Edited 4 years ago

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)

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). ApexBrick 59 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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?

0
its not a loop just deletes the whole folder in one instance. OX_X4 2 — 4y
0
Would you mind posting the actual script? ErskinePierre 48 — 4y
0
done added the script OX_X4 2 — 4y
0
I would add a wait() towards the end of the code anyways since the error is basically saying the script is exhausted azimn 0 — 4y
Ad

Answer this question