Hello there! I have tried making a time format system (seconds to hours, min etc.) It works fine, but i get this annoying error which i think could break something
I have tried formatting the function in another way, but that didn’t help.
Here’s the code if you wish!
local plr = game.Players.LocalPlayer
local plrTime = plr.leaderstats.Time
local formatted_time_string
local timeLabel = script.Parent
local function Format(int)
return string.format("%02i", int)
end
local function formatTime(seconds)
local minutes = (seconds - seconds%60)/60
seconds -= minutes * 60
local hours = (minutes - minutes%60)/60
minutes -= hours * 60
local days = (hours - hours%24)/24
hours -= days * 24
formatted_time_string = Format(days) .." days, ".. Format(hours) .." hours,".. Format(minutes) .." minutes, ".. Format(seconds) .. " seconds"
end
local function changeLabel(value)
formatTime(value)
timeLabel.Text = formatted_time_string
end
changeLabel(plrTime.Value)
plrTime.Changed:Connect(changeLabel(plrTime.Value))