# Making a time counter for a daily reward claim system!

Hey there!

I’m making a Daily Reward system and I watched a lot of videos on it, everything is working but I want to make a chrono under the dailyReward to know if you can claim it or how much time you have to wait.

So i went on a function like this:

``````local function convertTime(n)
local String
local hours = (math.floor(n / 3600))
local minutes = (math.floor((n - (hours*3600)) / 60))
local seconds = (math.floor(n-(hours*3600)-(minutes+60)))
if hours <= 9 then
hours = "0"..hours
end
if minutes <= 9 then
minutes = "0"..minutes
end
if seconds <= 9 then
seconds = "0"..seconds
end
if hours ~= 0 and minutes ~= 0 and seconds ~= 0 then
String = hours..":"..minutes..":"..seconds
else
end
return String
end

while wait(1) do
if lastClaim then
text.Text = convertTime(os.time() - lastClaim)
end
end
``````

So it gives me the time between the last Claim so I give me 35 minutes and 2000 seconds it’s why I don’t understand ;-:.

So How can I fix this to give me something like : “Next in: 09:57:30”.

Thank you!

Oh okay, when I red me back I found an issue wich fix the seconds problem.
It comes from the line:

``````local seconds = (math.floor(n-hours*3600)-(minutes+60)))
``````

I replaced the “+” by the “*”

But I still need help to find how can i get the time remaining instead of the past time between the lastClaim and now

if the claim must be exactly 24 hours later, this could work

``````text.Text = convertTime((24*60*60) + lastClaim - os.time())
``````
1 Like

Hey!

I just find my solution!