HUD Help

So, this is what I have so far

[LUA]

function myhud()
local client = LocalPlayer()
if !client:Alive() then return end
if(client:GetActiveWeapon() == NULL or client:GetActiveWeapon() == “Camera”) then return end
draw.RoundedBox(6, 10, 5, 400, 40, Color(0, 0, 0, 255 ))
draw.RoundedBox(2, 20, 15, 380, 5, Color(255, 91, 91, 255))
draw.RoundedBox(2, 20, 19, 380, 15, Color(200, 0, 0, 255))
draw.SimpleText(client:Health() … “% Health”, “ScoreboardText”, 150, 15, Color(255, 255, 255, 255), 0, 0)
draw.SimpleText(client:GetActiveWeapon():Clip1() … " /", “ScoreboardText”, 150, 30, Color(255, 255, 255, 255), 0, 0)
draw.SimpleText(client:GetAmmoCount(client:GetActiveWeapon():GetPrimaryAmmoType()) … " Bullets", “ScoreboardText”, 175, 30, Color(255, 255, 255, 255), 0, 0)
end
hook.Add(“HUDPaint”, “myhud”, myhud)

local text = string.format( “Health: %iHP”, client:Health( ) );-- get health text

[/LUA]

The problem i have is that the health bar doesnt decrease at all when i lose health. I tried looking in the Wiki but I couldn’t find anything that would do that. I know its probably pretty easy but this is my first HUD related thing. So if you could help me out that would be awesome. I also would like to say that i based this off one of the wikis.

Are you updating the text?

Yeah, the text says what % my health is at just the bar doesn’t go down at all.

Take a look at the code for your bar.

It’s all numbers. Constants that won’t change.

If the maximum width of your bar is 380, then to make it change with the health do something like


380 * client:Health() / 100