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

Infinite loop help?

Asked by 9 years ago
01wait()
02local c = game.Players:children()
03 
04for d = 1, #c do
05local cc = c[d]
06 
07if cc.Character ~= nil then
08    cc.CameraMode = ("LockFirstPerson")
09 
10    for i = timeTillGameEnds, 1, -1 do
11        h.Text = "Time left: " .. i
12        wait(1)
13 
14     end
15end
16 
17end
18 
19h.Text = "Time's up"   
20wait(3)

This is a script for a minigame. When I test it, the time counts down from 20, and when it gets to 0 it repeats and starts counting down from 20 again. It never breaks out of the code to say "Time's up!"

Answer this question