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
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