Replicating Health bars using UMG?

I have my health and stamina bars but I keep getting an error since I cannot find the right way to get the player controller. Server/Player is able to see its bar but the client produces the return not found and the bar remains blank.

I used the UMG UI tutorial as the basic start.

Any ideas I will post the BP screenshot when I can if needed.

If I remember correctly, the widgets can be owned only by a player controller.
The blank pin, named “Owning player” on the “Create Widget” node is auto fed the character’s controller and you should be able to retrieve it.

You could use the GetPlayerController node to get a reference to the local player. GetPlayerController(0) always returns the local player.

Edit: I think AdAstra’s method if getting the widget’s owning player works too. Since you see the widget on the client, that means you have added it to the local player’s viewport, right?

You need to get the owning player then cast to your custom Player Controller.

So long as the actual value is setup properly to be replicated it will work. UMG’s / HUD’s are local only, they have no knowledge of each other on the network and exist client-side only.

yes i understood this where I think i have the gap is where do I assign the HUD to the player controller? Is it in the character, hud or widget.

That’s done in the GameMode, which specifies which HUD to give to every Player Controller :slight_smile:

There should be a dropdown for it.

No the HUD is working for either A single player or B the server/client but additional clients see the HUD but the info polling from the MyCharacter gets an accessed NONE error since it is not finding the clients MyCharacter to assign it