How to spawn character according to a team param(Multiplayer)


I’m working on a MOBA type game, so i need to spawn multiple pawns on the map on 2 differents location according to the team tag.
Right now, i have a menu like the multiplayershootout to host a game, join a game and choose a team. The team number is saved in the game instance.
I can host perfectly a game as server and join the game with a client and spawn the 2 pawns. The problem is that i don’t know how to retrieve the team number associated to the player.

Here what i have on my player controller, on begin play I tell my controller to execute the spawn event

Then on the gamemode, i look on what team is supposed to be the player and i spawn him to the associated location.

So, when i launch the server everything is fine, i can read the team number but when a client join he reads the same as the server and not the client(new player) team. I checked what player controller was in my respawnGM input and even if it’s the client controller, i don’t have the associated variables.

This is my first steps in multiplayer programming so maybe i miss something, i would really need some advice to make this work, THANK YOU.

Ideally you would set variables in the game mode after joining the server not before… as far as i recall once you join a server all your client set variables are gone, because you now use the server game mode and player controller/pawn etc.

I set the variables in the player state, so each player have the team i want no problem with that. The issue i have is to get those variables in the gamemode. I don’t understand how exacly i can tell the server , “hey look at this player tell me in what team he is and spawn him here”. Now it’s more like the server know in what team he is but not the other players.

Hi Tmadec!
I see you are french so,
As tu trouvé une solution pour ton spawn?
Merci de ta réponse :wink: