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!