Health Bar Scaling not working

I am somewhat confused as to what to do here. I am trying to make the health bar scale to the right side of the frame instead of the left.

As of now the only thing I thought of was changing was the tweened UDIM2 to the following:

UDim2.new(Health, 0, -1, 0)

But even after attempting that it just made the frame become nothing.

local Player = game.Players.LocalPlayer
local Character = Player.Character
while task.wait(0.1) do
	if Character then
		break
	end
end
local Bar = script.Parent.MainFrame.GameBars.Health.Bar.Health
local Humanoid = Character:FindFirstChildOfClass('Humanoid')

Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
	local Health = (Humanoid.Health / Humanoid.MaxHealth)
	Bar:TweenSize(UDim2.new(Health, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.15, true)
end)

Anyway, if anyone can help me with this, it would be greatly appreciated. :grinning: :+1:

Hey there,
looks like you are searching for the property called AnchorPoint. Changing this property will affect the direction a GuiObject will scaled in. If you set your GuiObject’s AnchorPoint to 1,0 it should scale towards the left instead of the right.

Hope this helps!

It’s probably the AnchorPoint of the frame - if the X-axis of the AnchorPoint is set to 0, it will size to the right. On the other hand, if the X-axis is set to 1, it will size to the left.

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