How do I make a 24 hour timer for a daily login reward?
I want it so every 24 hours a player can receive an award of money. (Similar to Bloxburg) How would I do this?
How do I make a 24 hour timer for a daily login reward?
I want it so every 24 hours a player can receive an award of money. (Similar to Bloxburg) How would I do this?
24 hours = 86400 seconds
os.time will tell you what time it is in UNIX time, the clock of seconds that has been ticking since January 1st 1970!
so if we save the os.time when the player joins, we can detect when the player joins we can do current UNIX time - last seen UNIX time
then we take the answer, if its more than 86400 then the player has joined 24 hours ago and you can carry out with rewarding them!
helpful links: https://developer.roblox.com/en-us/api-reference/class/DataStoreService https://en.wikipedia.org/wiki/Unix_time https://developer.roblox.com/en-us/api-reference/lua-docs/os
if this helped then be sure to upvote or mark as answer! as always please reply to this if you have any questions or need more help
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
What if they changed their time on their OS? So they could change the time and rejoin over over again to get more reward.
this is not something that could happen, the time is being taken from roblox's servers which cannot have their times changed by any client
Thank you! This helped and I upvoted.