if you need to hud in your character you should call GetPlayerController and from that GetHud instead. Note: it could be the case that the hud is not created at begin play yet… what is the reason you need the hud in your character? I would advise to do it the other way around (e.g. access the character from the hud)
Thanks for the quick response, i’m trying to change the health of the character when it takes damage in the character blueprint, the health bar is in the HUD because i thought it would be easier to get a reference for the HUD than cast to the individual pieces which i plan on adding.
Unfortunately the GetHud didn’t work and i’m also trying to get this to work for multiplayer and setting the health in the HUD ether wasn’t working or it was changing the health of both clients.
What about creating a dispatcher for the health in the character? Bind the HUD to the change health events and update the health accordingly. Another way is simply getting the health every tick in the HUD and updating it.
From what blueprint are you updating/changing the damage from. If its’ from the character bp, then what you have there should work fine. If you are updating from your hud bp, then you need to create a variable for your char in your hud, and set it the same was you did above as the hud reference, but u need to set it before it’s added to the viewport for the reference to update properly. Note, when you go to add the “set” command to the structure you have, before the addtoviewport command, make sure you uncheck the context sensitive in your right click menu so you can access your HUD variables. Then choose the “set whatever_you_call_your_char_variable” from your hud, command and connect the nodes.
Also the reason it’s coming up multiple times is because your executing it via a sequence which is just like a loop and it will continue to execute that sequence during the games ticks unless it’s pushed off the sequence, halting it…