Integer into progress bar

I’m working on trying to take my health (which is an integer) then converting it into a float for the progress bar:

however, when looking at the progress bar in game, it is either full or empty rather than going steadily down. any advice on how to fix the issue would be great! thanks,

Percy

I don’t think you need to divide to 100 to convert from an int to a float

Hey MadkingPercy,

Because you are doing the divide before turning the result into a floating point number, it is being returned as 0 instead of something like 0.25, as an example.

To explain more:

75 / 100 = 0.75 but because Health is a integer value, it will result in 0 (dropping the decimals because integer variables do not have any floating point numbers).

To fix this, you’ll want to turn Health into a floating point number (float) before the divide. As such:

that’s great! Thank you for explaining!!!

Hello again, using this same method for a different project but progress bar no longer updating at all no matter what it is always empty. would you happen to know why this is?

Hey MadkingPercy,

Make sure that your new progress bar is both valid (as in your cast is successful and you can get that value - such as health) as well as when you divide it, its result is a floating point number (like the screenshot above) and it is from 0.0 to 1.0.

If you can, please post a screenshot or more information related to how this new progress bar may be different from the health bar.