Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

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

Asked by
OX_X4 2
1 month ago
Edited 1 month 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 — 1mo

1 answer

Log in to vote
0
Answered by 1 month 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 — 1mo
0
Would you mind posting the actual script? ErskinePierre 46 — 1mo
0
done added the script OX_X4 2 — 1mo
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 — 1mo
Ad

Answer this question