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

Infinite loop help?

Asked by 8 years ago
wait()
local c = game.Players:children()

for d = 1, #c do
local cc = c[d]

if cc.Character ~= nil then
    cc.CameraMode = ("LockFirstPerson")

    for i = timeTillGameEnds, 1, -1 do
        h.Text = "Time left: " .. i
        wait(1) 

     end
end

end

h.Text = "Time's up"    
wait(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