How to create an HUD in a multiplayer game?

The PlayerController class runs for the local player on the player’s machine, and for every player on the server.
However, the server doesn’t have a GUI.
So, the right thing to do is to set up the HUD class to a user widget blueprint of your choice.
In the HUD, the Player Controller will be that of the local player, on the local player’s machine.
Cast the player controller to your player controller class, and use that to read out things like hitpoints or whatnot.

It’s important to realize that you should remove all input key controls from the player pawn/character class. Instead, just have input variables for “amount of running” and “amount of turning” and such, and update the movement component inputs inside Tick(), rather than on controller input events. Move all the controller input event stuff to the Player Controller.
Without the clear Pawn / Controller distinction, you’ll be fighting the networking system and the already-existing systems for the engine, instead of benefitting from them.

3 Likes