Toggle visibility for UI panel

I have an UI panel in main menu whose visibility I want to control using a button.
photo_2023-12-20_12-54-05

What nodes should I use to change the state of this function when the button is pressed?

Don’t bind the visibility, just get your button event OnClicked and inside it get the the panel visibility, add a switch on it, and do what you want based on the visibility:

Add what ever combination you need.