How to detect if player Is NOT connected?

Im making sort of scan that scans thru all tracked players and if it detects it will check if he is connected to server and only continue if he is NOT connected.

Any way to do this?

i know ply:IsConnected() but any way to make oposite of it?


not ply:IsConnected()
ply:IsConnected() == false
not ply:IsConnected() == true
ply:IsConnected() == not true


If you’re new to languages placing an exclamation mark before a boolean reverses the check, so:
bool = true
if bool then // means if bool == true - it will run
if !bool then // means if bool == false - it will not run

Just a clarification that “not” is also accepted in Lua, as shown in cartman’s first example (in fact ! is an extension in GMod Lua).

[lua]if not bool then[/lua]

–snip, wrong context