tick() returns how many seconds have passed since the EPOCH time (January 1st 1970) in the machine’s timezone. os.clock() returns the amount of CPU time used by Lua in seconds. os.time()returns how many seconds have passed since the EPOCH time, however it is more precise and you can control the format, and which timezone it’s based on.
tick() works fine in most cases, but os.time() is more precise so it should be used instead.
The time will be nearly the same in both tick() and os.time(), since they use UTC. However, you cannot expect it to be equal since it’s based on the local machine’s time. workspace.DistributedTime won’t work either, since it’s currently not synced between the server and clients.
For server logic that is dependent on time (such as daily rewards) you should be using os.time() on the server because it is synced across Roblox servers to use the same timezone.
You should not be using tick() from the server or os.time() from the client.
If you want something that that is synced between the server and the client you will have to write some code to sync the server os.time() to the client.
Oh ok, because as I heard, all servers are in the US so that means if someone that is in Australia plays, their tick() is going to be different. Maybe that’s why my reward was glitching for the client…
Yeah tick() is based on the timezone that the client or server is in. The way you should set up your rewards system is to periodically check os.time() from the server and then tell the client if they are eligible to collect a reward. And then you check it again when they send a message back saying that they want to collect their reward. You should not be verifying it on the client.
I know I can do this via a remote function, but still. I would like to have a number that keeps increasing, something like tick(), but that it doesn’t work depending on the time zone.