You have to click again on the game window for the game to be able to read inputs from your keyboard. Thats just how scratch projects work