Synchronizing Timers Between Server and Client

Hi, I am currently creating an obby where on each stage you have 10 seconds to complete it (adjustable but most of the time its 10 seconds).

Currently, all I have is a timer on the client side, which will kill you once the timer runs out.
Of course, this is very insecure, especially as a core game mechanic for my game, as exploiters can just stop the timer or delete the timer script if they want.

My concern is when I try to create a server sided timer, the timers will desync on server and client, as a result of lag and networking stuff, and it will result in a bad game experience, with inconsistent timers.

How would I go about creating a timer that synchronizes between the server and the client? Where the server runs the timer and the client displays it on a gui. (For clarification, each player has their own timer)

You can use workspace:GetServerTimeNow(), which is accurate within a few microseconds between server and client. Set the timer on the server, and give the client the timer’s expiration timestamp, as workspace:GetServerTimeNow() + 10

1 Like