I have been experimenting with this function and in its description it says “It doesn’t involve data deserialization or processing.” I experimented in game by increasing my ping on the performance stats by running a speedtest on my browser. I noticed that the increase of ping from the speedtest does not increase the ping time given by :GetNetworkPing.
With this discovery, I would like to know if this is a valid method of getting the time that it takes for a remote event to go from client to server. In other words, is the data deserialization or processing included in the time it takes for the event to move from client to server?
It’s probably because :GetNetworkPing measures the network layers ping directly and is isolated from other activities on your device that might introduce latency. If you want to redo the experiment, try using a remoteEvent with a timestamp.
client code:
local startTime = workspace:GetServerTimeNow()
RemoteEvent:FireServer(startTime)
Just did the stress test with a timestamp and there was a lot of fluctuation during the test. So I suppose the answer is never to use :GetNetworkPing() for your time calculations.
I ran the test too, and there’s a lot more fluctuations than GetNetworkPing because now we have to account for data serialization/deserialization and the application process which can change depending on a ton of different things. GetNetworkPing and remote event/function timestamps have two very different use cases
Also I updated the code I sent above because I realized ping was round trip and not 1 way:
client code:
local startTime = workspace:GetServerTimeNow()
RemoteFunction:InvokeServer()
print(workspace:GetServerTimeNow() - startTime)
server code:
RemoteFunction.OnServerInvoke = function(player)
return true
end
Both methods are useful depending on what your use case is