Client tick() being far ahead of server tick() when FPS is unlocked?

So im making a remote cooldown script and client has to send its tick() to the server for comparison with its tick(). One of the checks is if the received tick() is not higher than server tick().

This is the result when im in studio (60 FPS):

Client tick(), Server tick(), Server tick - Client tick
image

The difference is only 0.015 which is normal, and now in the game with unlocked FPS:

Client tick(), Server tick(), Server tick - Client tick
image

The client tick() is over 3500 ahead of the server tick() and the gap is not always consistent.

I want to use tick() for hitreg in the future and with this problem i dont know what to do. Ive heard some people used this technique in their games, so does anybody know what to do?

1 Like

tick() returns the seconds passed since January 1, 1970 but in local time. So you are passing the tick() from the player’s timezone and using it against the server’s timezone.

os.time() should be used here instead; it returns seconds in UTC time since January 1, 1970 and can guarantee consistency. Plus tick() is going to be deprecated in the future.

2 Likes
4 Likes