Health Bar Issue

I have this game I’m developing, It’s one of those “Kick/Punch Wall Simulator” type games. I have an issue with the Health Bar (SurfaceGui) on the Wall. I don’t know how to fix it.

image_2024-05-01_072933615

Wall:SetAttribute("Health", Wall:GetAttribute('Health') - Player.leaderstats:WaitForChild('Strength').Value)
Wall:GetAttributeChangedSignal("Health"):Connect(function()
    Front:TweenPosition(UDim2.fromScale(Player.leaderstats:WaitForChild('Strength').Value / tonumber(Wall:GetAttribute('MaxHealth')), 0,5,0),
          Enum.EasingDirection.Out,
	  Enum.EasingStyle.Linear,
	  1, true
	)
end)
VFX[Type]:Play()

just use tweenservice, it looks better.

--why is the health reduction just plain there,
--is it supposed to be a touched event or something?
local strength = Player.leaderstats:WaitForChild("Strength")
local ts = game:GetService("TweenService")
local info = TweenInfo.new(1, Enum.EasingStyle.Linear)
local MAX_HEALTH = 120--change to actual maxhealth, or add an attribute maxhealth

Wall:GetAttributeChangedSignal("Health"):Connect(function()
    --assuming front is the green thing
    local tween = ts:Create(Front,  info, {Size = Udim2.fromScale(Wall:GetAttribute("Health")/MAX_HEALTH, 1)
 
  tween:Play()
end)

and now the bar resizes when health goes up or down.
TweenPosition is deprecated, Why do I see so many people using deprecated things.
Use the better versions, refer to the docs if you suspect something is deprecated.

Please specify the issue so we can help you fix it

I think you should be tweening the size, not the position.