ESC Key To Home Menu

Im working on a flappy bird game for my college assignment and i want to make it so if you click ESC or the back key on the phone after you die it will take you back to the home menu and to make sure that if you by accidentally click ESC or the back key while playing it wont work but when it says game over it will work

this is what you’re looking for. just do the if in an Update and only when gameover: