Dedicated Server - Player State values are empty in Game Mode

Hello, I’m trying to switch from the main menu to the game by connecting to a dedicated server session.
The problem I’m having is that I’m unable to read the player state from the server after the OnPostLogin event is executed, the default values are returned.

Below are the images of my blueprints:

Game Mode
When the player first loads the game map, he is directly connected to the dedicated server. in the OnPostLogin event, the playerinfo saved in the game instance is sent to be saved in the player state. and the player is spawned using the Respawn Player event, where the selected class by the player in the main menu is spawned (here is the problem)

Game Mode Function
This function retrieves the player info from player state and returns the selected class by the player in the main menu. In this function the retrieved values are correct if we are not connected to the dedicated server session, while if we are connected to the dedicated server they are the default values

Player Controller
This event is located in the custom player controller blueprint where it calls the set Player Info variable located in the in the custom player state blueprint

Player State
This event is located in the custom player state blueprint where it saves the sent PlayerInfo

Please help me solve this issue, it’s been almost a week and I still haven’t solved it!

Thanks in advance :slight_smile:

I forgot to mention that I have added Delay functions just for testing, because I read that sometimes the player state takes time to be set on the server, so the function might be executed before the player state has been set

I found out that when I execute the “open” command, the player state’s data is cleared. So now I need to find a way to be able to transfer the data that is in the game instance to the player state when the OnPostLogin event is executed, and I can’t seem to find the proper way.

Can anyone please enlighten me with the best practice to do so in a way to make sure the player did not manipulate with the PlayerInfo?


Use a save game and load it on post login.

Hey there Inph1del, Thank you for your reply.

I just solved my problem by doing the following:
In the Player State blueprint, in the “Event BeginPlay”, if it is “Remote” then I get a reference to the game instance and I call a server event and pass it the “PlayerInfo” and assign it into the player state variable

Could you please explain this better, or show blueprints? I’m not understanding and I have the same problem.

Hey there JLBXB3

Here are the blueprints of my Game Mode and Player State


Player State

Thank you, I appreciate it!

you’re welcome :slight_smile:

Thank you very much for your answer! This is what I need