Healthbar / Progressbar not updating

Hello!

We’re a group working on a school project, and we’ve fallen into a little bit of a headache. The problem is that the healthbar (progressbar) doesnt update on damage taken.

Here is a picture of the blueprints that are suppose to update it:

Now, a few facts to save time:

The blueprint is written in the Character BP.
The “HP Main” float has a value of 100.
The widget (healthbar) shows up on screen.
The character DOES take damage, and dies after X hits from the enemy.

Im really at a loss right now, and Im hoping someone can aid me in solving this.

Best regards,
Mats J

Is that cast working? If you plug a print string into cast failed does it fire that?

would it be nice if I suggest another way to create a Health bar?

I plugged a print string inbetween the Cast and Set Percent, and nothing happend. When I plugged it into Cast Failed it printed.

So I guess the cast doesnt work. However, I dont see why. I made a exact set-up for the enemy and its health bar, and it works just fine! So something has to be wrong with that exact cast (“Cast to W_HUD” on main character).

any suggestions?

This set-up is on the enemy, and it works. Seems quite similar, doesnt it? :confused:

Yeah, any help I can get is muchly appreciated!

A better approach is to go to widget graph > go to the bound function graph, from there do the same thing but instead cast to the blueprint where the player health is stored. And you should be just fine. This is the proper way to deal with a widget. In my example it is stored inside the character BP.

You also don’t need an event for doing this. It will automatically update the health whenever it changes.

Regards.

This worked perfectly. Thank you so much!

I’m glad I could help. Please set the answer as Resolved by clicking on the green tick below the answer vote.