Toggle Menu just works one way

I have this code for toggling my optionsmenu but it only works when hiding the menu.
In // I had another way that didn’t work either so I went for the if else statements but that gave me the same result. I would rather have “optionsMenu.SetActive(!optionsMenu.activeSelf);” work, but I’ll take any solution at this point.
Sorry if it’s a dumb question I’ve just started coding in C#

void Update() {
    if (Input.GetKeyDown(KeyCode.Escape)) {

        if (optionsMenu.activeInHierarchy == false) {
        else {


if you disable the GameObject on which the script was added, the Update() method will no longer be called

dumb question maybe. but this script does not by chance reside on the same gameobject you are setting active/false? because as a result of being set to inactive, the update method would no longer be called and “optionsMenu.SetActive(true)” will never be executed.

OMG YES, Thank you both so much!!