Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 comment

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

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.