I see this alot when I use a UI event. Cause I was about to make a script that will make you open the GUI with KeyCode. Just telling this question because there might be some error using this without knowing.
InputBegan is when the player clicks the button, InputEnded is when the player releases the button, you can trigger events to happen by using these methods