HUD Paint not posting updated variable value

Hello All!

This is my first time posting and I’m quite new to programming in Garry’s Mod, but have experience in C++ and VHDL. I’ve been able to program a .lua file to count the number of steps based on the PlayerButtonDown function and stored the information in a variable named count. I want to be able to display the updated value whenever it is changed in HUDPaint using a custom font which I’ve named “DisplayFont”. What I’ve found is that it only displays the initial value of count, but doesn’t bother displaying any changes to the variable count. If I locally declare it in the function, it’ll change. Would anyone happen to have any ideas of what’s gone wrong? Thank you!

//Font Creation
hook.Add( “Initialize”, “FontCreate”, function()

	surface.CreateFont( "DisplayFont", {
	font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
	extended = false,
	size = 100,
	weight = 500,
	blursize = 0,
	scanlines = 0,
	antialias = true,
	underline = false,
	italic = false,
	strikeout = false,
	symbol = false,
	rotary = false,
	shadow = false,
	additive = false,
	outline = false,
	} )

end )
//Count increases depending on the w key
hook.Add(“PlayerButtonDown”, “Count_Steps”, function( ply, key )

if((key == KEY_W)|| (key == KEY_O)) then
	//net.Start("Walk_Path")
		if(key == KEY_W) then
			count = count+1
			PrintMessage(HUD_PRINTTALK, count)
		
		elseif(key == KEY_O) then
			count = 0
		else 
			count = count;
	end
	end

end)

//Display the number of steps taken
hook.Add(“HUDPaint”, “MyHudName”, function ()
draw.DrawText(count, “DisplayFont”, ScrW() / 2 - 70, ScrH() - 63, Color(255, 255, 255, 255),TEXT_ALIGN_CENTER)
end)

You don’t need to place all your hooks inside an Initialize hook, otherwise all other stuff will only be update when map reloads, also i can’t see it, but where is defined count