Keeping track of team switches is not the best method. You're better off just calling get team. The reason i say not the best method is iirc switching a player via one of the many methods there is wont call the event. Other than that it looks good! Ill have a better look and confirm if my theory is correct
If it isnt ill approve heh.