Sorry about the confusing title. I’ll explain a bit more here:
I’m making this corny “Survival the Killer”-esque game, and I’m having a round timer be implemented. A LocalScript is currently running all of the base game values. Essentially, a timer is being counted down and a value is set to the current time. My script is updating the timer textLabel to be the time, and I use a format function to make it set into an actual time.
My issue arises when I try to set my text to the time. I have it printed for mine and your convenience:
I’ve tried tostring() but apparently the format isn’t an acceptable argument, so it also errors. Any help would be greatly appreciated, as I say in all of my posts.
Would I be able to see the format function please? The code seems to be fine, but it’s probably something that’s within the format function that causes the error.
This converts the number into a format like this: 00:00 correct?
If so you can use this code to format it the same way:
local function ToString(x: number)
return string.format("%02i", x :: number) :: string
end
local function ToFormat(x: number)
local minutes: number = (x :: number - x :: number % 60 :: number) / 60 :: number
x -= minutes :: number * 60 :: number
return ToString(minutes :: number) .. ":" .. ToString(x :: number)
end