how would i make a timer instead of like a countdown like 1000, 999, 998 and so on
but i would like to make a timer with like 30:00, 29:59, 29:58, and so on
The base number needs to be in seconds. In this case I make a timer for 24 hours. Each hour has 3600 minutes so I do 24 * 3600
local timerTime = 24 * 3600
local hours = math.floor(timerTime /3600)
local minutes = math.floor((timerTime - (hours*3600))/60)
local seconds = ((timerTime - (hours * 3600)) - (minutes * 60))
textLabel.Text = hours..":"..minutes..":"..seconds
Let me know if this works!
local TimeRemaining = 30; -- in minutes
TimeRemaining *= 60;
repeat
local Minutes = math.round(TimeRemaining / 60);
local Seconds = math.round(TimeRemaining % 60);
TimeRemaining -= 1;
TextLabel.Text = string.format('%d:%02i', Minutes, Seconds);
until
TimeRemaining <= 0;
-- everything beyond here runs when the timer runs out