So I am trying to make a timer that formats something like this: [ min:s:ds ] but I am not sure how. I already have a script from the devforums:
local textObject: any = script.Parent
local MAX_TIME_DEFAULT: number = script.Parent.TotalTime.Value
local timeRemaining: number = MAX_TIME_DEFAULT
local rate: number = 1 -- 1 times a second
local accumulated: number = 0
game:GetService("RunService").Heartbeat:Connect(function(deltaTime: number)
accumulated += deltaTime
while accumulated >= rate do
accumulated -= rate
if timeRemaining > -1 then
local seconds = timeRemaining % 60
local formatString = '[ %d:%d ]'
if seconds < 10 then
formatString = '[ %d:0%d ]'
end
textObject.Text = string.format(
formatString,
math.floor(timeRemaining * .0166666667),
seconds
)
end
timeRemaining -= 1
end
end)