My life bar isn't working

As the title says, when I create the GUI for my life bar, there isn’t anything showing up inside of it. I took the code from and instead of using public float playerEnergy = 1.0f; I used my own public float health = 50f; that I have been using in my whole script.

I do get the nice bar at the top, but no filler for the actual health. Even when I use the playerEnergy = 1.0f; I do not get anything in the bar. What gives here?

Without seeing your project I’d guess it’s one of two possibilities:

  1. You haven’t set the fgImage texture

  2. playerEnergy has to be between 0.0 and 1.0 (which I guess you have already tested, but it should be in this range in any case (playerEnergy/maxPlayerEnergy))