:GetNetworkPing() value barely changing

I am trying to use :GetNetworkPing() to get the player pings on a server script but they barely change. I am multiplying it by 2000 to match the actual ms value AND yes its in a loop. Like when I join the game for the first time and it gives me a value it always stay around that value. If it gives around 90, it will sometimes see 88.9999 or something like that and then come back to 90. Why won’t it change properly? Its in a server script used for leaderboard.

for i, player in pairs(game.Players:GetChildren()) do
	
-- other leaderboard stuff

	local pingLabel = playerSlot.plrPing
	coroutine.wrap(function()
		
		while true do
			pingLabel.Text = player:GetNetworkPing() * 2000
			wait(1)	
		end
		
	end)()
-- other leaderboard stuff

end
PLR.ChildAdded:Connect(function(player)
	if script.Parent.leaderboardFrame.ScrollingFrame:FindFirstChild(player.Name) then return end
-- other leaderboard stuff 

	local pingLabel = playerSlot.plrPing
	coroutine.wrap(function()

		while true do
			pingLabel.Text = player:GetNetworkPing() * 2000
			wait(1)	
		end

	end)()
	

It’s called a floating point error. Just round the number.

The issue is not the number having a lot of digits. The issue is that it doesn’t reflect the actual ping, as it stays the same/very close to the initial value when you join the server. I join once and it says 90 ping, rarely changing to 89.999. Then I join again and it says 150, rarely changing to 149.9999 even though the ping the roblox shows is the same as the one in previous session. It isnt showing correct values.

2 Likes