Learning how to make a hud - Help?

I have spent a day or two learning lua and how to make a simple hud for gmod, I have come up with this with one little problem, The healthbar shows up behind the healthbar background.
The healthbar it’s self is a Draw.RoundedBox and the background is a draw.poly, Not sure if thats the issue here but It could be.
http://pastebin.com/4EbNnEW9

Any feedback is appreciated, Thanks!

First off, what is with your spacing?

Anyway, it’s all about the order you draw it.

So if I draw a white box over a black box, and want the black box behind the white box, I’d draw the black box first, then draw the white box.

I understand that, I had changed the order and it did the same thing, Very confusing as im only just learning how to make a HUD.

Quick bump???

Still not fixed, Le sigh.

Don’t bump within a span of a few hours
Anyways, if the health bar is drawing behind the black bar, that means you’re drawing the health bar before the black bar.

Generally, your code is unclean, you are hooking multiple times, whilst being in a hooked function, wich is unoptimized, please fix your code first.

Get rid of all the unnecessary returns in your code you start a function and it has nothing in it until like 30 lines down, nobody wants to read and dissect sloppy code.

There is a hole series of making a Garrysmod Addon / Gamemode here: https://www.youtube.com/watch?v=qxvB-QwMc5M&index=3&list=PLCFyE3cH3BEF_1Dxh6UiTSS7TwpXavZZO

Watch that how to make a hud, in the video he is using a GAMEMODE CONSEPT, simple instead of using GM: just make a…

function HUD()
– Hud stuff he says goes here
end
hook.Add( “HUDPaint”, HUD )

you know if you have a look around it aint that hard…

As I said im using this as a test because I want to learn how to properly make a hud, I apologize that my code is untidy.

[editline]27th July 2016[/editline]

I am talking about the drawpoly corrosponding with health 3/4 and armor 2/3 ect, No matter how I set it up it ends up infront.

[editline]27th July 2016[/editline]

I understand the basics, Like what you have posted there.

[editline]27th July 2016[/editline]

Nevermind I managed to fix it, Thank you all for your help, Sorry my code was extremely untidy, Im fixing that up now.