So upon research I saw using os.time() is better than tick(). I haven't worked with either of them. I want to create a daily rewards system. I'm not exactly sure how to work with os.time() if someone can give me some insight. I did this to try to get an understanding and figure out the date/time.
print(os.time())
It outputted this, I have no idea how to work with that
1531602258
os.time() returns the number of seconds since Jan 1, 1970. You can use os.date() instead.
os.time
is indeed the best way to create a daily rewards system. As Phantom stated, os.time() returns the number of seconds since the epoch, January 1st, 1970. It's a number that is always increasing. If you save the os.time()
at which the player was last in the game, and then subtract it from the os.time()
when they rejoin, you will be given the amount of time that they haven't been in the game, in seconds. Using this, you can check to see if they were gone long enough and, if they were, reward them.