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

How do you bypass the exhausted allowed execution time error?

Asked by 3 years ago

I've been having an issue where I get the Script timeout: exhausted allowed execution time error. Can someone point me in the right direction?

repeat
    if game.Workspace.Dummy4.Humanoid.Health < 100 then
        game.Workspace.Dummy4.Humanoid.Health = 60
    end
until game.Workspace.Dummy4.Humanoid.Health == 0

1 answer

Log in to vote
0
Answered by
Wayyllon 170
3 years ago

The problem you have here is that you never added a wait!

However; there's a more efficient way of writing this code!

game.Workspace.Dummy.Humanoid.HealthChanged:Connect(function(Health)
    if Health <= 100 then
        if Health <= 0 then

        else
            Health = 60
        end
    end
end)

This should work; if it doesn't use this instead:

repeat
    if game.Workspace.Dummy4.Humanoid.Health < 100 then
        game.Workspace.Dummy4.Humanoid.Health = 60
    end
    wait()
until game.Workspace.Dummy4.Humanoid.Health == 0
0
ALSO: if you only want it to fire when the health is over 100 remove the = at the end of if Health <= 100 then. Wayyllon 170 — 3y
0
Thanks, I'll try it XbloxKing21 0 — 3y
0
It worked, thank you so much! XbloxKing21 0 — 3y
Ad

Answer this question