How to make logic for main menu?

You have to consider that this is “normal”, you don’t want the whole game menu to be loaded in memory while you are playing, the normal behavior is to never return to the main menu.
Of course it all depends on your game.

If you really aren’t going to constantly go to the main menu, I’d like to show you something more elaborate.
I have a Mainmenu Player controller, scene and gamemode. As a note the settings are not part of the main menu as they can be called from the inGame pause window.
The map of the main menu is that I put the settings.