Multiplayer: Transfering players and data from level to level

Wow, iam crushing my head over that problem now since 2 days and cant seem to find the right solution :confused:

I have two levels, the first for the gamelobby ‘A’ and second for the actual game happening ‘B’.
The players do some customization inside A, like which team they belong to etc.
Each player has an unique playerID stored in his game instance.

So the server saves the following info in his game instance:
unique playerID XXXXX: chose this race, this color, this team, etc…

Now the server changes the map to the actual gamemap, players reconnect and need the information:
where do i start? what did i chose for a team? what is my race, color, etc?

I could store all this info clientside, but i that could be used to cheat, like playing races that the client has actually not unlocked. So, somehow the server must receive the unique playerID on the client’s reconnect / login, and match that with the playerdata array he stored inside the server’s gameinstance.

Here is what i got so faar and is working fine:
Inside the Lobby-Level A:

  1. If the host presses start:
    Bind all customization data to the player’s unique playerIDs, pack that into an array and store it inside the GameInstance
  2. Use the ServerTravel Command to change the map

Inside Level B:
3. On GameMode::PostLogin get the just created PlayerController, and request his unique PlayerID from his GameInstance. Now unpack the PlayerData array from the server’s GameInstance and set the correct PlayerState’s variables with data where the packed playerID equals the just joined Controller’s playerID (retrieved form his gameinstance, here lies my problem).

Now here lies the problem:
I can’t get the correct SteamID in the last step 3. of the just joined Player.
If i just create a function inside the PlayerController that retrieves the GameInstance’s variable “playerID”, it will always return the Server’s playerID. I think the cause for this is, that the PlayerController is created on the serverside before the Client is fully connected, and the PostLogin Event is beeing called whilst the Server is still in control (thus always returning the Server’s / Hosts unique PlayerId).

A Workaround was to set this function on the PlayerController::BeginPlay event with a delay of ~0.4seconds and use a server-side replicated event to tell the steamid. This grants the client a little bit more time to grab and take over the fresh created PlayerController, but using that workaround might cause problem with clients who have a slow hardware.

So how am i supposed to transfer playerdata between levels that is bound to their ID which is only accessible clientside?