Problem with F1 menu?

I’ve been making an F1 menu for people that join the game and have no idea what to do, but When I press F1 to close it it pops up again. So I tried making it so that it has an ‘x’ button, and it does, but people don’t really seem to see it and just click F1 anyway. Is there some sort of preset of GMOD that will allow it to close of another push of F1 or do I have to manually do it?

Thanks.

Assuming that you create the panel every time, add this to the start of the function:
[lua]if mypanel then
mypanel:Close()
end[/lua]

Perhaps I’m doing it wrong, but it still doesn’t want to work
[lua]function ShowHelp()
if DermaPanel then
print(‘test’)
DermaPanel:Close()
else
local DermaPanel = vgui.Create( “DFrame” )
print(‘test1’)
DermaPanel:SetPos( 50,50 )
DermaPanel:SetSize( ScrW()-100, ScrH()-100 )
DermaPanel:SetTitle( “Help Menu” )
DermaPanel:SetVisible(true)
–DermaPanel:EnableVerticalScrollBar(true)
–DermaPanel:EnableHorizontal(true)
–gui.EnableScreenClicker(false)
–DermaPanel:SetBackgroundBlur( true )
DermaPanel:SetDraggable( false )
DermaPanel:ShowCloseButton( false )
DermaPanel.Paint = function()
surface.SetDrawColor(0,0,0,200)
surface.DrawRect(0,0,DermaPanel:GetWide(),DermaPanel:GetTall())
end

--[[local SystemButton = vgui.Create("DSysButton",DermaPanel)
SystemButton:SetPos(ScrW()-300,60)
SystemButton:SetSize(100,30)
SystemButton:SetType("close")
SystemButton.Paint = function()
	surface.SetDrawColor(0,0,0,0)
	surface.DrawRect(0,0,SystemButton:GetWide(),SystemButton:GetTall())
end
SystemButton.DoClick = function()
	DermaPanel:SetVisible(false)
	gui.EnableScreenClicker(false)
end]]--

end

local y=75
local x = 1
for k,v in pairs(HELPMENU) do
yes = HELPMENU
local text = vgui.Create(“DLabel”,DermaPanel)
text:SetText(yes)
text:SetPos(75,y)
text:SizeToContents()
text:SetWidth(360+256-8)
y=y+14
x=x+1
end
end
concommand.Add(“showhelp”,ShowHelp)[/lua]
Thank you.

Well maybe if you make a button somewhere that is visible. For example.
[lua]
local DermaButton = vgui.Create( “DButton” )
DermaButton:SetParent( DermaPanel )
DermaButton:SetText( “Play now!” )
DermaButton:SetPos( 150, 430 )
DermaButton:SetSize( 90, 25 )
DermaButton.DoClick = function ()
DermaPanel:Close()
end
[/lua]

That will work.

Well if I do that, then I don’t want the user to be able to open it up 50 times, and be like “SPAM!” and then like “/whine”

What…?

I think he means if the user presses F1 loads of times, it will keep opening more menus and they will have to click the button to close them all.