How should I switch a person to another team in minecraft?

So let's say I have 2 teams, Winner and Player. When a player is the only one left on Player, I want to add them/switch them to Winner and remove them from Player. I already have all the testing for figuring out how many players there are on a team, but I still need the command for switching the players.


Solution 1:

To switch a person still on the Player team to the Winner team:

/scoreboard teams join Winner @a[team=Player]

You can only be in one team at once, so this will also automatically remove them from the Player team.