There are 2 ways. I will first show you the correct one (and easiest so far), using the PlayerController to handle the input:
And if you want to keep doing it in the widget blueprint:
Just remember: The correct place to handle input is the Controller.