Custom HP bar scaling weirdly when going down

Hey there, im currently making a custom HP bar. It works fine, except when the HP restores, it doesnt scale up to the same place than it started. This happens around 50% of the time and it fixes itself after taking damage again. Im not sure how to fix this.

Ive looked for a way to fix this on the dev forum but i cant seem to find any that help me out. I think it has to do with the frequency of checking the players HP, but im not sure how to make it update more frequently.

Heres some screenshots of my script and the frames


Screenshot 2022-08-19 at 19.40.46

If you have any further questions, I would happily answer them.

Im not too much into scripting, but what I understand from the code here is whenever the players health has changed, it will run the function you made.

But, it will ONLY run when health is changed which is why it only fixes when the player takes damage again, since the health status has changed.

I suggest putting this in the scripting support category.

ohh okayyy thank u so much ill put it there!

Honestly, it either is your UI being misscaled, you should use Humanoid:GetPropertyChangedSignal(“Health”) in my opinion.

well its not the scaling because it scales properly half of the time and it fixes itself too. how do i use Humanoid:GetPropertyChangedSignal(“Health”)?

Please send me the project in a PM and I’ll fix it quickly. :slight_smile:

Humanoid:GetPropertyChangedSignal("Health"):Connect(function()

local health = Humanoid.Health

end)

could you place this in my script? im not sure where to put it and if i have to get rid of a different line of code.