player timing out?

How do I check if a player is timing out using “Player:IsTimingOut”,
i know that it returns true if a player times out but how can I get that information to run a function or open a dframe?

If you want an almost instant response you can use a think hook

and check if the player is timed out. However you wont be able to send data to the players client as they have clearly timed out. Not too sure how you’d use IsTimingOut to send data to a client who no longer has an active connection to the server.
That function is only really good if you want to do something on the server only.

true that, but looking at the many crash screens addons there must be certainly a way to check wheter the player is timing out or not, how can I do that?

They would check via the client, not the server. So avoid server funcs. I might be wrong though, anybody correct me if I am.

its probably a client side script to begin with, I just wonder how to make it

I’m sure there’s an easier way to do this, but I think you could broadcast a net message on server every N seconds and clientside do your stuff if the message hasn’t been received for too long. That’s just a guess tho.

Just make a timer that runs every second on server start up and if a player returns true for Player:IsTimingOut then do something like this

local function timeout(ply)

	timer.Create("Check player timeout", 1, 0
		if ply:IsTimingOut() then
			/* Stuff */


hook.Add("InitPostEntity", "Setup time out", timeout)

  1. InitPostEntity hook doesn’t pass any arguments and is only called once.
  2. Even if it was called for each player, your code wouldn’t work because timer names must be unique. (Also the timer like that one must be removed after the player has disconnected or it will cause errors)
  3. And lastly, OP said they wanted to open a DFrame on timeout:

That’s a clientside thing. Detecting if a player is timing out serverside isn’t hard, however the question in topic is about detecting it and doing stuff clientside.

One way you could do it, which could be very expensive, is have the client check for a connection to the server every now and then through net messages and if it doesn’t get a response, do what you have to do.

–snip-- Don’t do this…

Alternatively when someone’s ping exceeds about 500 you could call it, entirely on the clientside.

Player:Ping to check and then just do your normal HUDPaint stuff, not nearly as consistent as having a ‘is timing out’ hook though.

That would not work. If a client is timed out, they won’t receive a message from the server. You also don’t need to make a timer for every player that joins.

Serverside, create a timer on startup that broadcasts a net message every 5-10 seconds. Clientside, check if you haven’t received that message in a while, then open your derma panel.

So every client is constantly sending a message to/fro the server, and if the server detects a client hasn’t sent a message back after, let’s say, 5 seconds, send a specific client (I guess OP?) a message forcing open the DFrame and the unresponsive player’s information. I’d suggest using net messaging, because that seems to be the go-to option for custom client/server communication.

I don’t want to be rude, but this has been said so many times in this thread and now you’re making me repeat it: if a player is timing out, you can’t send them a net message - they won’t receive it, because they’re timing out!

You can, though, broadcast a net message every N seconds serverside, and clientside do stuff if it hasn’t been received for too long, as I said above. When I wrote that post I was sure there was an easier way to do this, but now I’m not that sure about it, to be honest.

Can you show an example how to do that exactly?

So maybe don’t be rude and read the full answer? I suppose it might be easier to broadcast the message (using net.Broadcast()) and compare the # of replies to the amount of players loaded into the server, but neither one of us is wrong here.

@MGFear You’ll want these links:

Read up on the first (it also provides some good examples you can emulate) as it teaches good, basic practices regarding the Net Library, and use the second as your resource for all of the net message functions. If you need someone to basically write it out for you, I’m sure someome may be up to spending the time to do so, but it’s not all that difficult if you follow the examples in the first link.

What’s the point in having clients reply?

For confirmation that the client hasn’t timed out? I thought that’s what this whole thread is about: OP wants to determine if clients have timed out. A timed-out client won’t receive messages from the server (they’ve timed out), so if you broadcast a net message to all players who are “in the game,” with the expectation of receiving a reply (meaning they’re not timed out), any client that doesn’t respond has probably timed out.

This of course may not be the case for clients far away from the server (clients w/ high ping), so checking for timed out clients every 5 or so seconds is probably best (you could probably go 3 or even 1 second), although it really just depends on what you think.

The client needs to know they timed out, not the server or any other player. Besides, serverside only

Player:IsTimingOut does that for you, you don’t need to “send a net message and expect a reply every 5 seconds”. The OP stated he wanted to open a derma window when the client is timing out. As I stated before, you do not need clients to reply to a message in order to complete that.

OH, I guess I completely misread what OP meant. I thought he wanted to devise a function from scratch along with sending the OP’s client a command to open a derma window. I totally misread that.

I want to go and react to everyone one of my responses with “dumb,” cause that’s what I’m feeling right about now.