This will work as long as the bar has a maximum value of the maximum hp. This is a Proof of Concept; if you want to use it in your project, give me credit.