I’m trying to make a multiplayer game with two teams, and I want to create a respawn system, but the team number is randomly assigned to the player at the beginning of the game. The only way I know to restart a player is to call
RestartPlayer(AController* NewPlayer)
in the gamemode, but that resets the team. I’ve also tried to make a player controller class to store it, but I can’t figure out how to cast to the controller, so… What should I do?
Use the PlayerState. And make sure you call the server to update the the PlayerState values to replicate it to the clients.
That worked! Thanks for the advice!