Removing widget and effect after pressing button?

Hello everyone,

I created a widget blueprint which turns on when I click on a model. Hovering the model also highlights its contorn (made this in Level Blueprint) following this tutorial.
It opens a menu with buttons, you select one of them and then it dissappears.

So now I want to enable the clicking event when I press a button -SpaceBar- :

-Start game
-Press SpaceBar -Game pauses, locks view too-
-Mouse cursor appears and you can select the models. Hovering the cursor over them, makes the highlight appear.
-Click on a model, press button menu and widget blueprint dissappears.
-Press again SpaceBar and Game unpauses and unlocks view.

The problem is if I press SpaceBar while in the middle of getting the menu, it doesnt dissappear. It stays on top of the screen in unpaused mode.
Besides, my highlight effect keeps showing even after I unpause the game.
How can I disable both of them?

I created a Controller Blueprint (pic related) with a Flipflop node but I’m stuck. Any tips on how to do this? Am I using the correct nodes? I hope I have explained my issue.

Thanks in advance

When you create your widget, create a reference (from “create widget” blue output : right click : make a variable) then use this reference to “remove from parent” instead of a new “create widget” which creates a new widget and not use the first one you created.

Thank you for answering
I still couldnt make it. Where do I create my reference? I’m doing it inside a controller blueprint, maybe I have to do it with a level bp?

HUD is still visible after I press space again.

If you have,'t create widget on event begin play, you have to create your widget when you need it : When you show mouse cursor, you create widget / create reference / add widget to viewport.
And remove it when you no more need it : When you hide mouse cursor, you check that reference is valid / if true then you remove reference from parent.