Problem with tweening Image Label

Hello, I’m facing a problem concerning the GUI. I want to make a health bar by tweening an image label.
Problem is, when it tweens, it shrinks in the y axis, something that I don’t want.

Here is my script:

humanoid.HealthChanged:Connect(function(newHealth)
local currentHealth = newHealth/100
if currentHealth <= 0.2 then
	HealthGradient.Color = ColorSequence.new(red)
	HealthBar:TweenSize(UDim2.new(currentHealth, 0 , 0.235, 0))
	isTweening = true 
else 
	HealthGradient.Color = ColorSequence.new(green)
	HealthBar:TweenSize(UDim2.new(currentHealth, 0 , 0.235, 0))	
end

end)

Thank you

Is the gui parented to a frame? If it is you can just set Y equal to 1.

Edit: Or you can use gui.Size.Y.Scale. Not sure it would actually fix it though, just so you dont have to keep updating your script value.

1 Like

Is the gui’s SizeConstraint set to XY?

1 Like

Yes it is, dont know what it actually does though.

Well if it’s XY then it’s fine.

1 Like