Timer problem script!

For some reason my script doesn’t work can someone help me? Its supposed to be a timer in one line of code and it has to be instead of 1:1:1 it has to have 01:01:01.

local hours = math.floor(player.Values.BoostLuckTime.Value / 3600)
local minutes = math.floor(player.Values.BoostLuckTime.Value % 3600 / 60)
local seconds = math.floor(player.Values.BoostLuckTime.Value % 60)

string.format("%02i:%02i:%02i", hours, minutes, seconds)

Well assuming the formatting is correct you need to print it or add to a textlabel or something and then run it in a loop to count up or down.

Try this:

local hours = math.floor(player.Values.BoostLuckTime.Value / 3600)
if hours < 10 then
    hours = tostring("0"..hours)
end
local minutes = math.floor(player.Values.BoostLuckTime.Value % 3600 / 60)
if minutes < 10 then
    minutes = tostring("0"..minutes)
end
local seconds = math.floor(player.Values.BoostLuckTime.Value % 60)

if seconds < 10 then
    seconds = tostring("0"..seconds)
end

This should fix the ‘1:1:1’ problem.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.