How to make a Pause Button

I’m trying to make a function where pressing P would pause the game, and then you’d be able to resume when you want by pressing P again or another button. But once the game is paused, I can’t press ‘enter’, for example, to resume since the game is paused, because it doesn’t take any key inputs. Any thoughts on how to do this outside of a timer?

simple
keyboard — pause (pause) ---- alert (show) ----- pause (play)
for the alert just put something like paused

I don’t know why I didn’t think of that. thanks