So, i know a way to make a timer the only way, but the one i want goes for 5 mins. I can type 5 mins. (script.Parent.Text = '4:59
I would have to do that but lower the number is the harder way.) of a certain code over, and over, and over again! Can someone help me?
You can use the Modulus operator for this. %
The Modulus operator takes the remained and removes it from the input. 63%60
would be 60 + 3 remaining, so it returns 3.
5 minutes would be 300 seconds. (Or just do 60*5)
To get rid of the "4:10", "4:9", "4:8" i do tostring("0"..math.floor(i%60)):sub(-2)
. This forms the numbers to a string and takes the last 2 values from it, giving you 04:10, 04:09, 04:08
A countdown timer would look like this:
for i=300,0,-1 do local Minutes = tostring("0"..math.floor(i/60)):sub(-2) local Seconds = tostring("0"..math.floor(i%60)):sub(-2) TextLabel.Text = Minutes..":"..Seconds wait(1) end