[Solved] Setting a boolean once in a infinite loop?

            Alright so let's say I press a Key to make the game be able to pause, when I press that key I want the game to be paused and have to be pressed again to un-pause. Problem is, press said key makes it pause and pause almost instantly and keep doing that. Any help? I would suppose it would have to do with having my own input listener that checks for individual presses instead of having the button held.
if(Gdx.input.isKeyPressed(Keys.ESCAPE)){
			if(gameScreen.isPaused() == true){
				gameScreen.setPaused(false);
			}
			else{
				gameScreen.setPaused(true);
			}
		}