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

Why does my intermission timer get exhausted, freeze my screen, and time out?

Asked by 4 years ago

I'm trying to make an intermission timer, and for some reason when I activate the intermission through a touched event trigger, my screen freezes and gives me this output message: " 10:05:45.871 - Script timeout: exhausted allowed execution time" Here is a snipet of my code where the error led me to, if you need the whole script to figure it out, I'll edit this question with the whole script! I know how these types of time outs work, but I put a wait in there, and it doesn't seem like its running much, so I'm confused.

        while PTCount >= 2 do
            local Status = game.ServerStorage.Status

            local PTChildren = PlayerTable:GetChildren()

            Status.Value = IntermissionString..IntermissionNumber..IntermissionString2

            -- Below this number is where the error led me to
            IntermissionNumber = IntermissionNumber - 1
            wait(1)
        end
2
if your screen freezes and it gives a script timeout error, it means something is running several times almost instantly. Check for any loops that that dont have a wait or, in your case, possibly an event that ran too many times. Try using a debounce: https://developer.roblox.com/en-us/articles/Debounce&ved=2ahUKEwikgt Erie20 102 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

You could just use a for loop for this.

startTime = 0
endTime = 10
increments = 1
for i = startTime, endTime, increments do
    print("Time: "..i.."/"..endTime
end
Ad

Answer this question