draw.RoundedBox not working

I’m working on creating a gamemode and cannot seem to get draw.RoundedBox to work.

Here is my code:

[lua]
if SERVER then

hook.Add( "ShowTeam", "TeamSelect", function( ply )
	ply:ConCommand( "teamselect" )
end)

else

function TeamSelect()

	local W = ScrW() - 120
	local H = ScrH() - 240
	local PosW = W / 2
	local PosH = H / 2
	
	draw.RoundedBox( 8, 100, 50, 100, 23, Color( 39, 174, 96, 155 ) )

end

concommand.Add( "teamselect", TeamSelect )

end
[/lua]

No errors or anything, it just ignores the code.

That’s not how it works.

[editline]2nd January 2014[/editline]

You either gotta use HUDPaint hook to draw stuff, or what better in this case, create a panel and override it’s PANEL:Paint hook

How exactly would I do this? Sorry, I haven’t really done HUDs.

He just told you; use the HUDPaint hook.

Right, I get that part. How would I make it draw when a player presses F2 is what I don’t get.

Toggle a boolean variable when F2 is hit and do a check on that variable in the hook?

You create a panel using “local a = vgui.Create(“DFrame”)” panel and do “function a:Paint( w,h ) /draw here/ end”. Don’t forget to set size and position of that frame, as well as a:MakePopup(). See wiki for any further questions about these functions.

Reading his code, yeah he should probably be using a panel instead of messing around with HUDPaint for a team selection menu.