I am currently using a loop to countdown the amount of time left in my game. The current amount of time a round in my game lasts for is 600 seconds or 10 mins. How would I make it countdown from 10:00 instead of 600?
COMMUNITY QUESTION
How would I add a minute timer for my game countdown?
1 answer
This script is very short because it is SO easy;
also set; "ResetOnSpawn" enabled in the current screengui you are editing
local timer = script.Parent
local minutes = 2
local seconds = 19
repeat
if seconds <= 0 then
minutes = minutes - 1
seconds = 59
else
seconds = seconds - 1
end
if seconds <= 9 then
timer.Text = tostring(minutes)..":0"..tostring(seconds)
else
timer.Text = tostring(minutes)..":"..tostring(seconds)
end
wait(1)
until minutes <= 0 and seconds <= 0
#Explanation
If the seconds is smaller than 0 then the minutes is equal to itself - 1 else the seconds will subtract by themselves
and you know the rest
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
https://developer.roblox.com/en-us/articles/datetime-format-strings