If anyone can assist me here, or direct me to where I can get help that would be really great, thanks.
(Also if anyone knows what xgui is coded in that would also be helpful. {Ex. Derma(vgui.Create) or this draw(draw.RoundedBox) stuff})
Have a toggle function, and a show and a hide function.
F2 runs toggle.
The toggle function checks a variable and or
IsVisible to see if the panel is visible, and runs hide if showing.
If not visible, the toggle function runs show.
Sorry, don't know command for closing, SetVisible or Close or something.
In a much more robust way, that's how XGUI does it.
Xgui is mostly written in the derma vgui. model, but has one or two drawroundedboxes too, which I thought was derma.
Sorry, I don't know Derma, etc.
The above is just my basic knowledge of lua/xgui and the little I picked up while looking through XGUI for what you were asking to do.