How can I detect a player's ping, show it in a text label, and then based on that show a GUI that the player is lagging?

So I’m trying to make a text label show the player’s ping, and then if it’s not good (I don’t know the correct word for this) show a GUI that says that the connection is poor based on the player’s ping but I don’t know how I would do this and if it’s even possible

Process to determine a players ping:
Create a RemoteFunction
Create an event that returns true, in a client local script, when invoked by server

Periodically perform the following (server-sided):
For each player, store the tick() in a local variable just before invoking the RemoteFunction to that player, then compare the tick() before and after to have the difference in time, aka the ping time.

Then it’s up to you what you do with this number. (E.g. A player with consistent 500+ ping probably won’t have a great time, but that’s just a random number I’ve pulled)

Note: You probably want wrap this function in a coroutine for each player called, otherwise it will have to yield for each player sequentially, which could take a while.

1 Like

Try taking a look at this handy resource made by boatbomber.

2 Likes