Use the slider in order to see the health bar change. You may use this in your projects but give me credit. I will use this in other games where I need to use a healthbar.
When the health goes to 0, the healthbar disappears, so don't mind that because I coded it to that.