How could I make daily rewards that reset at midnight? And should I?

Hey everyone who’s reading!

My goal is to make daily rewards that reset after midnight and this time-keeping system would possibly be used for featured item shop and “seasons” type system (~1 week after which top players are awarded).

I had an idea of using the tick() but I know not to trust it to client. I am not sure about os.date(), though.

So my question is - can this be done reliably and securely?

If not, what alternatives could be used? I’d prefer staying away from the whole wait-24-hours daily login thing.
If not this, then my best guess is i could just use the UTC time, make it all change at one time, save myself some nerves for later.

3 Likes

You can’t trust the client at all with tick, as when the game records the current tick, the client’s user can change the time on their device to the next day, thus granting them the reward.

Your best option would probably be to use os.time, since the OS library is sandboxed, but everything will change for everyone at 12AM (GMT/UTC Time)

2 Likes

Yeah… i really would need to get the timezone of the player if not the time, and i could use that on server to get the UTC os.time and correct for players time zone, so at least time would be correct, but the time zone could probably still be exploitable :confused:
This is kind of a blank page for me, so i don’t know if i can just reliably get the timezone.

UTC is the basic roblox time zone this can not be exploited so I would recommend just using that.

Come to think of it i think Adventure Up is doing it like that…
@filiptibell sorry to bother you, is this true? Maybe you can give some advice?

The best solution for us worked out to be to use os.time() and reset at the same time for everyone, with no adjustments for time zones. Here’s why:

Adjusting for time zones has a couple problems:

  • Some places have super weird time zones such as 30 minute differences instead of 1 hour (or way worse and weirder things)
  • People who play your game might be traveling between several time zones

Resetting the daily reward a day after it was last claimed also has an issue, being that the time keeps getting pushed forward by however much extra time you wait to claim it. At some point that will become inconvenient because you don’t want to stay up longer and longer each day to claim the reward. Dungeon Quest solves this by doing daily rewards every 12 hours instead, which is also an option.

4 Likes

Thank you for your response, didn’t think about people moving…
I guess it just so happens to be ± midnight for me when new daily reward comes :smiley:
I think i’ll just reset it either from 0 time zone or + 12 time zone. the 12 hour interval is pretty good also, but i much prefer a constant time when it is renewed for everyone, because i know i can keep coming back the same time over and over again.

1 Like