Try this, is using basic functions to format and “unformat” the text to number seconds and string format, but it works, you can change the format/unformat functions as you like:
I disabled the line using the Module, just for debugging, and using a hardcoded 30 seconds. Seems working for me
local function format_time(seconds)
local hours = math.floor(seconds / 3600)
local minutes = math.floor((seconds % 3600) / 60)
local seconds = math.floor(seconds % 60)
return string.format("%02d:%02d:%02d", hours, minutes, seconds)
end
local function unFormat_time(time_str)
local hours, minutes, seconds = time_str:match("(%d+):(%d+):(%d+)")
hours = tonumber(hours)
minutes = tonumber(minutes)
seconds = tonumber(seconds)
return hours * 3600 + minutes * 60 + seconds
end
local function TickTime(v)
--v.Text = format_time(DailyRewardsModule[v.Name]["ClaimTime"])
v.Text = format_time(30) -- for testing
print("welp")
while unFormat_time(v.Text) > 1 do
if unFormat_time(v.Text) > 60 then
-- do something when the seconds to wait is greater to 60?
else
-- Decrease time with format
v.Text = format_time(unFormat_time(v.Text) - 1)
end
task.wait(1)
end
if unFormat_time(v.Text) == 1 then
print("timeReached0")
v.Text = "Redeem"
--return
end
end
for i , v in pairs(Frame:GetDescendants()) do
warn(i,v)
if v:IsA("TextLabel") then
warn("label")
coroutine.wrap(TickTime)(v)
end
end