Preventing Images from losing their overall shape

I am currently trying to create a health-bar for a game I’m working on, and I decided to use images. The only down-side is the image getting displaced and losing its overall shape when a players health is low. Is there any way to prevent/fix this?

image
image

I have thought of a solution so I will share it and close the post.
To achieve this, you must use UI gradients “offset” property.

Your UI gradient should look like the following:

To change the gradient, in your script you can do the following:

local Calculation = math.abs(Humanoid.Health / Humanoid.MaxHealth)
Frame.UIGradient.Offset = Vector2.new(Calculation - 0.3, 0)

image

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.