According to documentation : One PlayerController exists on each client per player on that machine. These are replicated between the server and the associated client, but are not replicated to other clients, resulting in the server having PlayerControllers for every player, but local clients having only the PlayerControllers for their local players. PlayerControllers exist while the client is connected, and are associated with Pawns, but are not destroyed and respawned like Pawns often are. They are well-suited to communicating information between clients and servers without replicating this information to other clients, such as the server telling the client to ping its minimap in response to a game event that only that player detects.
https://docs.unrealengine.com/en-US/API/Runtime/Engine/GameFramework/APlayerController/index.html
So it is better to use the playercontroller instead of the character for accessing client and server?
Step 1 : Create Playercontroller, create interface and create reference to Playercontroller.
Note: Actually I also created the gamemode (see Part 7). I set the new gamemode for my level. So also as step 1 als take a look at step 1 of part 7. 🙂
Step 2 : Move blueprints from character to playercontroller
I am going to move the “Second video Part 5 extra changes” from the character to the player controller. This is just an exercise, I could argue that the best location for these Blueprints is actually the character.
So I moved the blueprints from the character to the playercontroller. I had to do some recompiling/ rebuilding. And I had to connect to Blueprints to the interface “Event Pickup Collected”. Also add the variable Healh which should be replicated.
Actually the biggest change was in the BP_Pickup. On overlap, the character (pawn) is given. It is the playercontroller of the character that you need. This can by achieved by using the Get Controller function. Also the Pickup Collected interface function had to be added.
Video result step 1 en 2
After entering the name in the menu. Get the playerinfo from the gameinstance and store it in the playercontroller on both client and server.
Step 3 Make SetplayerInfo in interface playercontroller.
Result in Dedicated Server