Sync tick() for client and server

Hi, I’m currently working on a game that works with CFrame:lerp() and I have to calculate the time difference dt. The server sets a StartTime and then server and client can calculate dt accurately.

The problem is I use tick() for StartTime, but if the client isn’t in the west coast time zone, the client gets a different output from tick()… For some reason when I use time() the game is 3 times as laggy as using tick(). I also tried os.time() + tick()%1 (since os.time() only gives integers), but that also lags (idk why).

Any suggestions? Thanks

@Quenty has a great module for this: https://github.com/Quenty/NevermoreEngine/blob/4bc3275ad8cfa0f703fae27b470dab9dc70254d2/Modules/Time/TimeSyncManager.lua.

3 Likes

Ayy thank you so much

Glad to help. Remember to mark my answer as a solution if it solved the issue.