Right now I have a timer that uses tick() for a race timer. So I send an event to the client to store the start time, and then every frame I calculate the time elapsed since the race started with tick() - startTime.
But the problem is that the time on the server and client is not the same so I always get an offset, how would I fix this?
I know that I can tell the clients the server time every frame but that is very slow.
Calculate the time on the server, and update a variable such as an int value in the replicated storage. Whenever the client needs the information, it can just grab the IntValue’s value from the replicated storage.
First when the race starts I send the server’s tick() to all clients to store as the startTime variable and then on the client every frame I update a TextLabel to show the time with tick() - startTime.
Okay, so to get it to match up, you’d have to find the players’ timezones and convert them all to one, and there’s tons of tutorials on how to get timezones, and to convert it all to one timezone, just minus hours from tick() depending on the player’s timezone.
For anyone searching for this in the future i found a much better solution by using roblox’s DateTime API. This also allows me to format time as a bonus!