Problems with creating a countdown

I’m trying to build a countdown timer that can be set by the user, everything works fine until the user tries setting a value over 59 hours, 59 minutes and 59 seconds.

Here’s a video of the issue:

Part of the script that sets the values:
image

And the part that converts to the HH:MM:SS format
image

I can’t figure out what the issue is any help would be appreciated.

I haven’t worked with this cocept before, but I believe it’s how you returned the code.

return(allthecode):format(s/60/60%60, s/60%60, s%60)

I believe your problem is located there. I’m not 100% sure if that’s your problem, but maybe increasing the first number of the hours part of the code?

Edit: As in (s/60/60%60, would be changed to (s/ANYNUMBERIDK/60%60, I’d try that.

You’re using modulo 60 for the hour counter, so it resets to 0 when you input 60 hours.

Replace this:
return("%02i:%02i:%02i"):format(s/60/60%60, s/60%60, s%60)

with:
return("%02i:%02i:%02i"):format(math.floor(s/60/60), s/60%60, s%60)

2 Likes

Thank you!

3Ocharacters3Ocharacters.

2 Likes