Detecting player log off

Hi, I'd like to detect when a player has logged off the server/ logged onto the server to then remove them from a team. I'm not 100% sure on how to go about doing that. was hoping someone else may have an idea?
Continue to help post