How do i reference my actor blueprint float variable in a widget blueprint?

Float works as health variable.
Enemy actor has default 100 as float every time the level starts.
For testing purposes, I have a collision box on my player character, and when the enemy actor overlaps, it subtracts 10 points from the float. with 10 hits, the enemy character loses all its hp points and its pawn gets destroyed.
This already works fine, but I want the float to be displayed on the widget, both as a progress bar and a text.
I have already gotten the overhead bar working, i just need the reference to the health variable and the real time hp drops every time he gets hit.

With testing, i have seen that the enemy receives damage and gets destroyed with 10 hits, but the float and the bar both stay at 0. How do i reference and animate the health bar?

widget component on my enemy blueprint

I have already gotten the overhead bar
working

Are you using a widget component or track a regular widget for this?

The character:

  • it has a collision sphere that deals random damage to whatever it touches

The Enemy:

  • it has a Widget Component set to Screen Mode
  • we get a reference to the embedded widget at Begin Play so we don’t need to cast all the time
  • when this enemy actor receives Any Damage, we calculate a new health value
  • we then use the reference to update the widget

The widget:

  • Construct fills the progress bar and sets the text to a default state
  • when the widget is updated by the enemy who owns it, we store the new health value to display
  • Tick interpolates from current percent to Target every frame and updates the Progress Bar and the Text Block
  • the health value is Map Ranged as the Progress Bar accepts 0-1 rather than 0-100

Image from Gyazo

Link to project: