Global variables that change on disconnect?

Hey there, I’m attempting to make a variable that changes on disconnect. Basically what it is - is:

[lua]
function GM:PlayerDisconnect(pl)
if pl:Team() == TEAMNAME_HERE then
TEAM_AMOUNT = TEAM_AMOUNT - 1
end
end
[/lua]
I’ve attempted to do this but no luck…

This is for a gamemode, correct?

Yessir!

Why not just track the number of players per team in a Think function?

Never thought of that… :v:

Or just team.NumPlayers( team_index )?

:wtc:

just use **[Team.GetPlayers

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Team.GetPlayers)**

:ninja: