I’m trying to create a timer for my duel system and display it in min/sec such as 4:30. So how exactly would I turn 270 seconds into 4:30? I tried doing something similar but it did not work at all. So is there some kind of formula to do this?
local min = 4
local sec = 59
local secounds = 299
repeat
wait(1)
secounds -= 1
sec -= 1
if sec < 1 then
min -= 1
sec = 59
end
script.Parent.Frame.TextLabel.Text = "Timer: " .. min .. ":" .. sec
until secounds == 0
function SecondsToMMSS(Seconds)
local SS = Seconds % 60
local MM = (Seconds - SS) / 60 -- you could also do local MM = math.floor(Seconds / 60)
return MM..":"..(10 > SS and "0"..SS or SS)
end
local seconds = 300
repeat
script.Parent.Frame.TextLabel.Text = "Timer: "..SecondsToMMSS(seconds)
seconds -= 1
task.wait(1)
until seconds == 0
should work, looks like you only want minutes and second
I even tested it to make sure