LocalPlayer:GetNetworkPing() returns 0 even if IncomingReplicationLag is not 0 in Studio

Reproduction Steps

LocalPlayer:GetNetworkPing() returns 0 even if IncomingReplicationLag is not 0.

Expected Behavior

GetNetworkPing should take into account the IncomingReplicationLag setting (e.g. if IncomingReplicationLag is set to 0.2 it should return twice that value, which is around 0.4)

Actual Behavior

GetNetworkPing always returns 0 regardless of IncomingReplicationLag’s value.

Workaround
Since IncomingReplicationLag cannot be accessed, there is no workaround short of hard-coding its value.

Issue Area: Engine
Issue Type: Other
Impact: Moderate
Frequency: Constantly

21 Likes

This is still a problem, I cannot accurately test lag compensation due to this issue. I will have to create my own ping measurement if not solved.

Thanks for the report! We’ll follow up when we have an update for you.

4 Likes

At first, I thought that you could only get ping on the server, but it definitely is an error if it isn’t working on the local player. It even states you can on the documentation. It should work with IncomingReplicationLag as well since it only makes sense.

1 Like

After doing tests, it apparently seems that it doesn’t work at all when testing it on Roblox. The ping will always return 0 on the client, even when getting it from the local player.

1 Like

Even I have this issue, :GetNetworkPing only returns 0

2 Likes

Wait it was a bug? I always thought it was intended to be inacurrate i even made a post about it.

1 Like

I believe its an internal Roblox bug but it also returns 0 for me. Hopefully it will be fixed soon.

1 Like

Hi, thanks for the report. Player:GetNetworkPing() does not take into account latency from the packet deserialization/processing pipeline in the engine, which is where IncomingReplicationLag is applied. The intention of this API is to measure the network latency between the client and the server, ignoring the engine-specific latency I mentioned earlier (deserialization/processing). So if you’re testing this locally in Studio, it’s not surprising the network ping is zero since the client and server are running on the same machine.

We don’t have a method that measures end-to-end latency, which sounds like what you’re looking for. Please file a feature request if you would like to see this implemented!

1 Like