Custom hud for sandbox server

Hello, I am a noob to lua and I wonder if anyone can make me a script that replaces the current Hud with A picture with text over it desplaying the HP.
I’m thinking of having a blue box with white text desplaying the Health and Armor. I can position it myself and make the box, I just need a script :v

You can find this stuff on the wiki

Go to 4.7

Edit oops you wanted health in text?

Follow this guy he has some good stuff

If you want to use GMod textures you can do something like this:

local gradient = surface.GetTextureID( “gui/gradient.vtf” )

function GM:HUDPaint()

function MyHUD()
local ply = LocalPlayer()
if !ply:Alive() then return end --If you want it to NOT display if the player is dead.

surface.SetDrawColor(Color(255,255,255,200)) -- A little bit of transparency.
surface.SetTexture( gradient ) -- The surface.GetTextureID is outside the hud paint function so it doesn't cause fps lag.
surface.DrawTexturedRect( 0, ScrH()-50, 300, 50 )

draw.DrawText( "Health: "..ply:Health(), "HudHintTextLarge", 5, ScrH()-40, Color(255,0,0,200) )


You can go here if you want to see what other gui images there is.

You can go here for a list of fonts for GMod 13.

This is just a basic example, but it should help. I haven’t tested this, so don’t expect it to be pretty.