Open/Close UI menu with key press?

At this point you may want to consider finding more step-by-step tutorials and following through them to get a better understanding of the engine and how to use it.
Game development is hard. It’s a lot easier to imagine a project than create it, and even with fancy tools like Unreal Engine, you can still spend months or years learning how to make something basic. After five years, you still learn new things every week.

As for your current task, I break it into two parts:
1 Detect when the player has pressed Tab
2 Show/Hide a UMG Widget

PART ONE -----
You can detect when the player has pressed an input in several places, in this case I think your best bet is to do it in the character. Here is some info on other places you could check for the input:
https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Input/#inputprocessingprocedure
First off, in your project settings under “Input,” set up an action for “ToggleInventory” and bind it to the Tab key on the keyboard.
After that, go to your character and make a node on the event graph for “Input Action Toggle Inventory”
Add some print string nodes to Pressed and Release, and then test it in your game to see if it works.
If you’re stuck, look up examples of setting up player inputs.

PART TWO ----
First, make a UMG Widget for your inventory. Don’t worry about making anything work, you can just add some images so that we can quickly get around to testing whether it shows up properly.
UMG is a whole system with its own ins and outs, I highly recommend Matthew Wadstein’s tutorials as the fastest way to get up and running with that.

The way I’m going to mention is the simplest way I can think of, probably not the way AAA games would work but it should work for you.
In your character’s BeginPlay function, add the following Nodes:

  • Create Widget (set the widget to the one you created for your inventory)
    Drag out from the blue node coming out of it, and click “Promote to Variable.”
    Name the variable InventoryWidget, which should create the second node:
  • Set InventoryWidget (connected by two wires to the first node)
    Now, the widget exists… but we can’t see it. Drag out from the blue node again, and add two more nodes coming from it:
  • Add to Viewport
  • Set Visibility (set the checkbox to Visible)

TEST-- Test early, test often! At this point when you start the game, the widget should show up on your screen.

But now you want it to toggle.

PART 3 out of 2 ? -------

First off, change the “Set Visibility” node you put on BeginPlay to “Hidden”
Now, the widget should not show up visibly when you start the game, but it does exist in memory.

Get rid of the print statements after the Input Action ToggleInventory and in the place of one of them, make these nodes

  • Get InventoryWidget, connected to:
  • Is Visible, connect the output of that to a
  • Branch
  • True branch output: Connect a InventoryWidget node to a “Set Visibility: Hidden”
  • False branch output: Connect a InventoryWidget node to a “Set Visibility: Visible”

That’s a lot of step-by-step. This video tutorial pretty much covers this half of the task, if you get stuck try following this: Displaying UI Widgets On Screen - #5 Unreal Engine 4 User Interface Development Tutorial Series - YouTube