How to make float limits

that return value should be used to set the HealthP variable, and you need to do that every time you update the variable.

so if your player gets hit and loses 20 health points: you would get HealthP, subtract 20, then clamp the result between 0 and 100, and use that result to set HealthP.