Hud sometimes not displaying health

You destroyed the actor the widget is referencing. You may want to create the widget in the player controller BP and pass it a reference of the spawned pawn. Then on respawn set that veriable to pont at the newly possessed pawn.

thanks. that sounds a bit dirty but ill take it as a last resort

i found a way. now i use getowningplayerpawn directly in the hud progressbar function. no need for a variable anymore!

in eventbeginplay of my character i create a hud widget and attach it to the viewport.
in the hud blueprint in eventconstruct i run getplayercharacter and save it in avariable for the hud to display the health.

but when my client respawns after dying the health bar is at zero. the server is fine. i discovered that getplayercharacter returns None.
does anybody know why?

Try putting a short delay on before reading the character reference.

Just try it to find out, I’ll give you a better solution in a bit…

directly in the hud progressbar
function

Just note that in order to get to the variable you’re probably casting. This executes every frame. Somewhat expensive if you allow these to pile up across many actors.