Hi! I'm fumbling around with my own game right now, and i guess i can explain how i made mine
First i made a jpeg file of how i want my healthbar to look (in my case just a bright red square bar)
I then changed the color of it to a darker red and saved it again so i had 2 files (a bright red and a dark red)
I then imported it to the scene of the game (the bright red first), set the width to 200 (make height whatever you want) and added an FSM to it.
first state has a simple wait function that waits for .1 seconds before going to the 2nd state (this is too avoid errors of trying to calculate health before the health has been set)
in the 2nd state, I use float operators to calculate the length of the bar based on the health of the player.
I assume you have a variable set for the max amount of health your player can have (in my example i used 300) and then another variable that tracks the CURRENT health of your player (so that could be 150)
first take a float operator and take the current health var and divide it by the max health var - store the result of this as "health divide result" variable.
now 2nd action, use another float operator - this time take the "health divide result" var and multiply it by 200 (width of health bar), and save the result as a variable called "health bar length"
As the last action, use the "Set GUI texture pixel inset size" action, and as the width, use your "health bar length" variable, and height whatever you want. Now make all of these actions update "every frame" by checking the "every frame" checkbox and it should now update it's width to match your health
for the dark red, i put that at the same location as the bright red, but put it BEHIND. This means that when the bright red health bar goes down, you can see the dark red behind it so you can see how much health you are missing.
This healthbar will also work if you have items that increase max health or something like that
Hope this helps, if you have any questions feel free to ask and i can try and help (i could make a video explaining my setup)
KozTheBoss