Hello! How do I make so that this countdown script formats the text in Hours:Minutes:Seconds instead of just seconds?
local GUI = script.Parent local ClickDetector = game.Workspace.CDStart.ClickDetector ClickDetector.MouseClick:Connect(function(clicked) for i = 120, 0 , -1 do GUI.Text = i wait(1) end end)
Not in the mood to explain, here's a way to get the format from a number.
function totime(number) local hours, minutes, seconds hours = math.floor(number / 3600); number -= hours * 3600 minutes = math.floor(number / 60); number -= minutes * 60 seconds = number if hours < 10 then hours = "0"..hours end if minutes < 10 then minutes = "0"..minutes end if seconds < 10 then seconds = "0"..seconds end return hours..":"..minutes..":"..seconds end
Put it at the top of your script, and on line 06 do Gui.Text = totime(i)
.