Vertical Armor HUD filling down, not up

As I said in the title, I’m having problems with the Armor bar in my HUD filling in the wrong way. Instead of bottom to top, it goes top to bottom .

Example: https://gyazo.com/78c3381b045c6df719c72de1a3b86072

Here’s the code for the armor.


draw.RoundedBox(2, RelativeX + 294, Scrh - HUDHeight - 8,20,  math.Clamp(LocalPlayer():Armor() or 0, 2, 100)/100*(HUDWidth-190), Color(0,125,255))  

Thank you for any and all help!

Just subtract the armour number you set for the height from the y coordinate


    draw.RoundedBox(2, RelativeX + 294, Scrh - HUDHeight + 98,20,  math.Clamp(LocalPlayer():Armor() or 0, 2, 100)/-108*(HUDWidth-190), Color(0,125,255))

Is this what you meant? This is the outcome: https://gyazo.com/ed2681a890c61967999ab8e5c14b227e

Though it does go from bottom to top. My apologies if I didn’t fully understand.

I meant more like this:



local height = math.Clamp( LocalPlayer():Armor() or 0, 2, 100 ) / 100 * ( HUDWidth - 190 )

draw.RoundedBox( 2, RelativeX + 294, Scrh - HUDHeight - 8 - height, 20, height, Color( 0, 125, 255 ) )


^ Untested

Thank you so much! That works perfectly.