How to create a widget and add it to viewport if both conditions are true

I’m trying to create a simple thing but I don’t how. I want to create a widget and add it to viewport (that widget is some sort of a save menu) when two conditions are true. The first condition is that the player is in a triggerbox and the second one is that E is pressed. The picture below shows how im trying to do that. Can somebody help me.

the simplest method to accomplish this would be to use a gate as shown below (fist Picture). the gate will control whether key input can go through based on if its open or closed. so if the gates closed your input cant go through, meaning you can press E all you like and you will never show the widget.

A second method you could use would be to enable and disable input to the actor based on the overlap as seen in picture 2. this may be a better method in some cases.

of course theres many other methods that could also be used such as using blueprint interfaces (possibly the best method if you have “use” key, but a bit more complex). you should also note that you may need to change the consume input setting in the details panel depending on which solution you go with. oh and i also added two different types of flow control here for examples sake, in the first picture theres a cast so the gate only opens when a character is overlapping, the second picture is set so the enable input only happens when the player character is overlapping. this extra bit prevents the widget from being created if your not the one who overlapped the widget, for example if you had a tree overlapping the actor and you were halfway across the map and press E the widget wouldnt be created since it wasnt a character overlapping the actor.

When I try the first method. It opens the menu when I’m in the trigger box without problem. But it doesn’t close when I leave the trigger box.
The second method doesn’t work because I can open the menu without even being in the trigger box. Help!

When I try the first method. It opens the menu when I’m in the trigger box without problem. But it doesn’t close when I leave the trigger box

you didnt ask for it to do that. its pretty simple to accomplish though, add a sequence node in after the end overlap event, then connect one pin to the close on the gate and the other to a remove from parent node (working from memory so may not be the exact name) which destroys the widget. that will make it so the widget is gone when you leave the collision volume.

The second method doesn’t work because I can open the menu without even being in the trigger box

this one isnt working for you because you are working in the level bp. i hadnt noticed you were using the level bp, i built my script in a bp actor. if your making something that will exist in many locations and or in many levels i would suggest that you make a actor for it. this will save you time (and probably perform better) since a actor can be reused, something done in the level bp you will have to recreate for each instance you want to have.

I created it as an actor and it works perfectly! Thank you again!