Yes of course you have to create a system where players are put in a different team and thus update their variable but if you can do that, the system I made should work. I used beginPlay to create the example but you would never do that in the actual game I think =)
A first step for improvement would be to put the Team variable in the player controller instead of the player I think.
Anyway if the answer is enough for you, don’t forget to accept it so other people searching for that can see the question as answered =)