Best way to get player ping?

Is there any Roblox approved way to get the player ping (I need it for some client sided lag compensation)

Right now I’ve been using RemoteEvents to just calculate the difference between tick() before and after receiving a signal, but it feels like there should be a better way.

10 Likes

If you want to sync accurately, I’d recommend you use Quenty’s Nevermore Engine. It’s got a library dedicated to syncing server and client time.


To my knowledge, there isn’t a perfectly accurate way to get ping.
However using tick() and a remote isn’t that bad, for just a basic ping anyway.

Quenty’s library does almost exactly this, as it turns out.

Just remember that tick() is local time, so it will vary on the client and the server.

10 Likes

you can also use os.time() as it is always the unix time in UTC

Edit: It does say on the wiki page that it could be a few seconds off though (different time on each system) and is only in seconds…
but then again you would most likely be checking the time both times on the server as the client would be able to change the time at their will (exploiters can modify the return) and also to make sure local time wont get in the way

3 Likes

To @EmeraldSlash’s post, here’s Quenty’s method for it:

https://github.com/Quenty/NevermoreEngine/blob/version2/Modules/Time/TimeSyncManager.lua#L99

18 Likes