How would i get client and server ping?

The ones i’ve found were deprecated, wouldn’t work or showed wildly incorrect numbers.
I’m talking something like pf did:
image

What should i use? And how? Complex or simple. Any help is appreciated.

I’ve used PlayerPing for my current game prototype, and it’s been extremely precise for getting the ping time on the server. Unfortunately it seems like it only shows round trip ping (thanks for pointing that out steven), but that’s probably for a good reason like exploit issues etc, but I’m sure you could reverse engineer it and get it to work that way as well.

Perhaps look into

I just looked at the demo and it was only off by 5ms max.

Ping is a round trip. A lot of people think ping is client → server or server → client. But ping is the full round trip of client → server → client.

If you’re looking for server → client and/or client → server. A simple way would be to when you fire a remote, send the time it was fired along with it. And on the server subtract the current time from the send time and that’ll tell you how long the message took one way.

@steven4547466 @Monkepath
I made my own while checking out the thing you guys sent and just wondering…
There were exploits mentioned:

What kind of exploits are theese? Is this a platform wide issue?

What boatbomber is explaining in that thread is that with the module the client can’t spoof its return ping to the server until it gets the “key” (the GUID), meaning that in practice an exploiter couldn’t make their ping on the server less than it actually is. I don’t know of any way to prevent spoofing the ping on the higher end (without monitoring every single communication going through the client-server boundary, and even then not if they can pause replication), but a max ping should be set anyways to ensure game playability, spoofing or not.

None of this is a platform issue unless you count exploiters being able to hack the client in the first place, this is all about player-created systems to measure ping.

1 Like

Sorry for all the questions :sweat_smile:. But i read just now, that remote events are vulnerable to exploits too. Do i have to perform sanity checks and/or pass on a random key to make sure all events are secure, or am i just overreacting? cuz it feels like i am

But that is one of the things i wanted to do, yes.

I think for your questions about security, it would be helpful to understand exactly what exploits are. Client-sided exploits in roblox are just ways for the client to send the “wrong data” to the server (or change what they see such as wallhacks), usually through modifications to their client (viruses, or server-sided exploits are similar but in reverse). Things like the player’s position which is naturally replicated to the server is therefore vulnerable to exploiting. These modifications can’t be fixed long-term since the client is just a program running on the exploiter’s computer, not the server’s.

Remote events by nature are just a way for the client and server to communicate by firing the event, sending the input values through the internet. Therefore, an exploiter’s client could send the “wrong” values to a remote event that the server is listening for. How you check this value to be “correct”, if you do at all, depends a lot on the nature of what that event is used for.

All that passing the key does with PlayerPing is make sure that the client can’t make the server do anything until they have the key to return. I don’t think a system like this would be useful outside of ping-related programs as it doesn’t stop the information itself from being “wrong”. You should still perform sanity checks though where reasonable, yes, especially for easily-exploitable things that wouldn’t be too expensive to check, such as gun fire rate, ammo count, or player position.

1 Like

So i was overreacting a bit. And i was aware of theese.
Idk i always think “how can i break this” when programming.
But this was still usefull. Thx. :smile: