Problem with health bar

Hello devforum, I just made a quick health bar. I have a problem with it. It scales on the two sides and since I don’t have much experience with UI scaling I am not sure how to fix that.

https://gyazo.com/19fe924d4598944db7d7b310ef339610

This is the script I am using:

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

local thing = script.Parent.Size.X.Scale / 100

hum.HealthChanged:Connect(function(Health)
	if Health <= 0 then return end
	
	local thing2 = thing * Health
	
	script.Parent:TweenSize(UDim2.new(thing2, script.Parent.Size.X.Offset, script.Parent.Size.Y.Scale, script.Parent.Size.Y.Offset), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.45)
end)

Thanks for reading!

Tween the position left or right, so it looks like one side is going down only.

1 Like

How do I tween it to one side only?

Try to change the anchor point to 0,0?

1 Like

Your anchor point is probably set to 0.5, 0.5. Try changing it to 0, 0.

2 Likes

Instead of doing that I suggest messing around with the AnchorPoint. As the AnchorPoint soul purpose is to be able to resize a part while it still being in the same position.

1 Like