UDim2.new hum.health

image
Below you can see UI, the player is damaged at it, ~20 hp. So, when person gets damaged the imagelabel should go down, but for some reason it goes up. How that can be solved?

local char = script.Parent.Parent.Parent.Character
hum = char.Humanoid
hum.Changed:connect(function()
	script.Parent.Frame.Player.beingweird.Size = UDim2.new(1,0,hum.Health/hum.MaxHealth,0)
	if hum.Health <= hum.MaxHealth*0.30 then
		script.Parent.Frame.Player.beingweird.BackgroundColor3 = Color3.new(0.505882, 0.101961, 0.101961)
	else
		script.Parent.Frame.Player.beingweird.BackgroundColor3 = Color3.new(0.156863, 0.505882, 0.105882)
	end
end)

Change the y anchor point to 1 (UI property)

1 Like

You need to negate the Y scale.
-(hum.Health/hum.MaxHealth)

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