while true do for s,Z in pairs(Players:GetPlayers())do spawn(function()if Z and Z.Parent==Players then if not pings[Z]then pings[Z]={Pings={};Average=0}end local s=tick()pcall(function()REMOTES.Ping:InvokeClient(Z)end)local A=tick()-s if pings[Z]then table.insert(pings[Z].Pings,A)if#pings[Z].Pings>5 then table.remove(pings[Z].Pings,1)end local s=0 for Z,A in pairs(pings[Z].Pings)do s=s+A end pings[Z].Average=s/#pings[Z].Pings end end end)end wait(1)end


while true do
	for _, player in pairs(Players:GetPlayers()) do
		spawn(function()
			if player and player.Parent == Players then
				if not pings[player] then
					pings[player]	= {
						Pings	= {};
						Average	= 0;
					}
				end
			
				local start		= tick()
				pcall(function()
					REMOTES.Ping:InvokeClient(player)
				end)
				local elapsed	= tick() - start
				
				if pings[player] then
					table.insert(pings[player].Pings, elapsed)
					if #pings[player].Pings > 5 then
						table.remove(pings[player].Pings, 1)
					end
					
					local average	= 0
					for _, ping in pairs(pings[player].Pings) do
						average		= average + ping
					end
					pings[player].Average	= average / #pings[player].Pings
				end
			end
		end)
	end
	wait(1)
end
