So i have already setup a team selector so they can select team A or team B. And then i display the players with a player reference. But if a player switches from team A to team B i want to remove the reference for the player on team A and add it on team B. How would I do so?
I usually use an extension function like this to grab team numbers
You can place it in whatever verse script you’re trying to use it for
(Player:player).Team_Number():int=
Print("Return Team Started")
Collection := GetPlayspace().GetTeamCollection()
Team_Array := GetPlayspace().GetTeamCollection().GetTeams()
AllPlayers := GetPlayspace().GetPlayers()
if(PlayerTeam := Collection.GetTeam[Player]):
if(Player_Team_Number := Collection.GetTeams().Find[PlayerTeam]):
return Player_Team_Number
Print("Something Failed Returning 99 ")
return 99
And then you could write a function that takes a player as a param and do something like this
Let me know if you get any errors bc i wrote these in a notepad since the servers are down lol
Do_Something_With_Team_Number(Player:player):void=
TeamNum := Player.Team_Number()
if(TeamNum = 0):
Print("Do something for team 0")
else if(TeamNum = 1):
Print("Do Something for team 1")