GetNetworkPing return invalid ping

how to get actual player ping?
using GetNetworkPing returns an invalid value and it never changes

code:

print(game.Players.LocalPlayer:GetNetworkPing() * 1000)

image
It gives a different result than the actual ping
image
also tested

but not really accurate, I want to achieve the same result as the Roblox client

have you tried timing the amount manually with clock.os()? Like sending a remote function and timing how long it takes. I’m curious about the difference between those two numbers because GetNetworkPing() should work

1 Like

Do you mean os.clock()?

1 Like

Like to time the start and end

1 Like

If you’re testing locally, that’s going to happen because the packet never leaves your computer. If you run the game on the live server, you should get different results. As others have said, you can create a remote event where the server sends a request to the client and time how long it takes using os.clock(). You get the time when you send the request, and you get the time when you get a response. The difference between the two is the round trip time.

1 Like

sorry for the late response, I was on vacation

I tested on the live server using both the studio and live server. However, the value never changes even if I stay on the server for a long time. So, what is the purpose of GetNetworkPing? It seems to do nothing. I initially thought it was a built-in function to get player ping, like in the Roblox client settings (performance stats).

Thanks for your suggestion about using the os.clock method. Although I already mentioned the pinger module in my post, I will try using that method.

Hey! So I actually managed to figure this out recently. You need to multiply the number returned by GetNetworkPing() by 2000. So would look like this:

print(game.Players.LocalPlayer:GetNetworkPing() * 2000)
1 Like