Players Leaving Game!

Is there away that I can make players change team (In this case PRISONER_DEAD or GUARD_DEAD) so when they leave and is the last player alive, the round restarts?

GM:PlayerDisconnected might help you, it’s called whenever a player disconnects.

It takes the player as an argument so you can check what team they were on and make your necessary changes inside.

Why are you using teams for dead players anyway?

Make 2 counters. Round starts, guards = count players in the guard team, prisoners = do the same thing.

When a player disconnects, and they were alive, reduce 1 from whichever count. When a player dies, do the same thing. If either reaches 0, restart the round.

This way you’re not constantly running logic in the background.

I’d recommend looking into gameevent.Listen for player_disconnect, as the regular Disconnect hook doesn’t always fire, and PlayerDeath.

Its the way the gamemode was made. On PlayerDeath switch to team PRISONER_DEAD or something. I think it puts them into spectator.