Timer script does not loop (Roblox Lua)

Solution 1:

I don't see any problem with the overall logic, so no reason for it to stop at 2:29, but there are some problems with formatting, as this is what I get when I run the script (a fragment):

1:10
1:9
1:8
1:07
1:06
1:05
1:04
1:03
1:02
1:01
1:00
0:059
0:58

As you can see, :8, :9, and :059 are formatted incorrectly.

Something like this may work a bit better:

repeat
    Guis.Time.Text = ("%d:%02d"):format(Minutes, Seconds)
    wait(1)
    Seconds = Seconds - 1
    if Seconds < 0 then
      Minutes = Minutes - 1
      Seconds = 59
    end
until Seconds < 1 and Minutes < 1