Drawing Individual Bullets for Ammo

I’m new with lua and this is my first project. Essentially I am trying to make my weapon ammo show up as individual bullets such as in Gears of War. I’m not sure why my code isn’t showing up on my HUD. Any help is greatly appreciated, thanks!

[lua]
bullet = surface.GetTextureID( “VGUI/ammobar” );

function hudAmmo()

local client = LocalPlayer();
local howManyLoops = client:Clip1();

for i=1,howManyLoops do
    surface.SetTexture( bullet );
    surface.SetDrawColor(255,255,225,255);
    surface.DrawTexturedRect(ScrW()-(i*5), 36, 128, 128);
end

end
[/lua]

change client:Clip1() to client:GetActiveWeapon( ):Clip1() and it should work.

Thanks, but that didn’t make it draw.

Edit:
I figured out how to make it draw using a hook but I still have a problem.
Whenever I die, I get an error message and then when I respawn, it doesn’t draw on my HUD. Here’s the error:

Hook ‘hudAmmo’ Failed: addons\supahud\lua\autorun\client\bulletammo.lua:8: attempt to call method ‘Clip1’ (a nil value)

Here’s my code
[lua]
bullet = surface.GetTextureID( “hud_bullet/ammobar” );

function hudAmmo()

local client = LocalPlayer();
local mag_left = client:GetActiveWeapon():Clip1()
howManyLoops = mag_left;

for i=1,howManyLoops do
    surface.SetTexture( bullet );
    surface.SetDrawColor(255,255,225,255);
    surface.DrawTexturedRect(ScrW() - (64+(i*4)), 64, 32, 32);
end

end

hook.Add(“HUDPaint”, “hudAmmo”, hudAmmo);
[/lua]