Close menu modificationSuggestion
Now i'm not a coder, but i've managed to make this work after a few hours of trial and error, changing methods, learning as i go, untill i figured it out.
I doubt this is the propper method
and I'm not sure if this will cause any trouble with the code trying to close an unnamed CUI, but i don't see any errors.

I modified the code to allow buttons to close the menu, enabling me to create an actual close "button".
This works on all buttons though and can also execute the command attached to it, even if the button opens another menu.

inside "private class ConfigButton" just below:
[JsonProperty(PropertyName = "Executing command")]
public string Command = "/tpa";​
add:
[JsonProperty(PropertyName = "Close Menu")]
public bool CloseMenu = false;
You can change the "false" to "true" if you want the default setting to close buttons.


In the "Loading buttons" for loop add the folowing two lines:
Below:

var type = button.IsChatCommand ? "chat" : "console";

add:

var isClose = button.CloseMenu ? "GameMenuCUI" : "";

And also inside same loop, just below:

Button =
{


add

Close = $"{isClose}",
Hey!
Thank you a lot for your suggestion
You're welcome.
Just wanted this for my own server and managed to do it myself, wanted to show others how to modify your code if they wanted.
If you like it and decide to use it, that's fantastic!
thank you guys! i figure out what i done wrong work perfect now :D when i make it true

 

it close last menu really good now, is important to set true when you have transparente menus.

also use bind key like this one:

bind m chat.say /menu

also remember to set permission, creat new ones it will help you keep commands only for VIP

Any way to set it up so only that button closes de MENU 
as when I click anywhere outside button MENU will close 
so to disable that and let the button do its job
Its intended to work so :/
Found what i was looking for ... so it was background closing menu all this time 
also as im using it as side menu .. when inventory was opened and items where trown out that background would not items to be trown out until whole menu was close 

those are the lines i was messing around to get  what i need

_backgroundButton = new CuiButton
{
Button =
{
Close = "GameMenuCUI",
Color = "0.6 0.0 0.0 1.0",
FadeIn = fadeTime
},
Text =
{
Text = string.Empty
},
RectTransform =
{
AnchorMin = "0.959 0.69", <----- THIS 
AnchorMax = "0.96 0.7"  <------ AND THIS
This isn't intended to be a side menu, you should use it and close. And consider creating a new thread, I believe it's a different topic.

Okay the original suggestion for changing the code works. Thanks for submitting that. 5 years later and its still a needed function lol