I'm trying to make a round timer with intermission, etc, (I have everything else set up) but the timer doesn't stop at 0, it goes into the negatives. Also, I don't know if I made the other parts correctly since I can't get past this part, thanks in advance if you are able to help.
01 | while true do |
02 | wait( 1 ) |
03 | script.Parent.Text = script.Parent.Text - 1 |
04 | if script.Value.Value = = 0 then |
05 | wait( 162 ) |
06 | script.Parent.Text = "Intermission" |
07 | wait( 20 ) |
08 | script.Parent.Text = 60 |
09 | end |
10 | end |
You can use a for
loop instead:
01 | function Countdown() |
02 | for i = 60 , 0 , - 1 do -- 60 = start, 0 = goal, -1 = step to reach goal, i = progress |
03 | wait( 1 ) |
04 | script.Parent.Text = i |
05 | end |
06 | end |
07 |
08 | function Loop() |
09 | Countdown() -- note that any code below a for loop will not run until the loop is finished |
10 | wait( 162 ) |
11 | script.Parent.Text = "Intermission" |
12 | wait( 20 ) |
13 | Loop() -- repeat function |
14 | end |
15 | Loop() |