How do I link text to a healthbar?

I have a healthbar that displays the health of my character, but I need to link text to the health variable so that the text displays my health out of 100. I also need to display it onscreen as I am having trouble with that.

This is my event graph - I’m not finished but I need the next step:

This is the node for my healthbar - again, unfinished and looking for the next step to sync the progress bar and the text:

This is the text - I am having trouble converting my healthbar percentage into a string and displaying it in the correct place:

This is where I have the text located and should be displayed:

As you can see the text is not appearing in the right place and will not appear as a percentage, but as a decimal:

You have a couple of options. But first let me help you make the widget a bit more efficient. You are setting a reference to the character on the widgets construction. But in the get healthbar function you are getting the player character and casting again. You can save some time by just using the referenced variable you created when the widget starts (New Var 0).

So In the Get Text function, you could set it by getting the percentage you have now, and multiplying that by 100 and setting that as the text. Or you can pull the health variable from New Var 0. I recommend the second since you don’t have to do an unnecessary math function.

Now as for the aligning of the text. I’ll need to see your widget settings pane for it. Because I don’t know if it’s parented to the health bar, free floating or how it’s supposed to be aligning.

Beat me to it. This should lead you in the right path. My bet is that the health value itself is normalized (between 0 and 1) like in the example from this guide. If that’s the case multiplying by 100 is still necessary in both cases. I’d also recommend following it up with a truncate node as well, if you don’t want any decimal place. This will effectively turn the value into an integer between 0 and 100.

Okay thank you, both of these answers were really helpful. Some things i don’t really get (ive had ue4 for less than a month) but what you suggested solved my problem so thank you

Well if you wouldn’t mind, would you mark the question solved for others searching for this problem?

Also is there anything I can help with what you don’t get?