Formatting the timer to HH:MM:SS

Hey, so I need some help with formatting this countdown to hours:minutes:seconds format (HH:MM:SS)

local db = false
local countdownString
game:GetService("RunService").Heartbeat:Connect(function()
     local countdownString = ("%s:%02i"):format(180 - os.date("!*t").min -1, 60 - os.date("!*t").sec - 1)
     script.Parent.Text = countdownString
    if (os.date("!*t").min == 0 and os.date("!*t").sec == 0) and not db then
       db = true
       task.wait(1)
       db = false
   end
end)
1 Like