When GetNetworkPing was introduced to the Roblox API it stated that it would “Provide information in milliseconds”, it also stated it could “Only be accessed on the server”:
To rectify this you could always multiply it by 2 which would show you the exact client number (as long as you converted it to milliseconds too by multiply by 1000)
The new ping function may just seem as a method to return a simple number but it can allow you to help laggy players, such as by compensating on the server such as in FPS Shooter games.
This function could also just be used as a way to show players an accurate method of their ping (However, I am unsure if it works on the client as I have only tested in the studio command bar and on the server F9 Console)
It was actually a complete coincidence that I discovered it. I just ran :GetNetworkPing() in the command bar in studio and noticed it returned a value.
I hope in the future I can release a tutorial detailing how to use it in lag compensation
Interesting, don’t know why Roblox can’t just have it as a property instead of you needing to call the function. I wonder if it would have performance implications for being called constantly (In my games I have a top bar panel for me that has the FPS and Ping so I can investigate if the game is laggy or not in general & I try to keep it as up-to-date as possible)
Possibly the reason it isn’t a property is because if it was a property the server would need to constantly update it which would be very useless if it wasn’t being used. Where a function can be called when and where it needs to be used which wouldn’t waste any performance as it’s being used.
It does if you observe it. Roblox has to keep track of it anyway.
Some properties already exist that work like this. Mouse.Target for example. Simply reading the property causes Roblox to perform the raycast if it hasn’t already. Either that or having the Mouse instance, but it’s basically the same thing.
I tested it myself in those screenshots and the numbers provided appear to be correct, if you have an alternate theory I would love to see some evidence or some screenshots provided but right now I don’t believe there is anything else.
I have noticed some gaps between the ping shown on the Shift + F3 menu and the one returned by this function and they seem to not be linked and it may have only been a rare occurance that the ping lined up.
You did however state I was incorrect by saying
which was why I was confused as I had already written that down.
If I multiply it by 2, that would be the closest result to my actual ping
There shouldn’t be a gap that large at all. If there is that means it’s returning inaccurate ping.
I tested this several times and got the same thing (in-game).
Someone else I knew even tested this and also got results not matching their current ping.
With my results, there no way it could be some fixed interval.
A way i found to get the ping delay is by having a NumberValue in workspace that i set on server with time(), then i compare it on client side by substracting client time() from it. I dono how accurate is this but it seems to work in studio too when i adjust the StudioSettings/Network/IncomingReplicationLag