[SOLVED] [LibGdx] [Desktop] Overlapping 'Button' Functionality

Hello. If you are reading this, then you have successfully found a very obvious scrub and have no idea wth i’m doing, and I am in need of your help.

I’m having an issue with my ‘buttons’ basically on the main menu. The way the buttons work is that there is just text on the screen and when the player clicks inside a certain area during that gameState, it will perform the function. (in this case clicking the button just send the player to an entire new gamestate).

My problem is that my ‘Back Button’ in the Options menu and my ‘Exit button’ in my Main menu overlap in position, but are not in the same gameState. when the ‘Back Button’ in the options menu (gameState = 1), is clicked, instead of proceeding with going to, gameState = 0, the game closes, which can only happen when the ‘Exit button’ is clicked during the gameState = 0. The only conclusion i have came to is that since they overlap and that there is no delay between the two gameStates, that the action during clicking of the Back button is also applied to the Exit button when the gameState is changed.

Any help toward a solution would be very much appreciated. ;D Thank you for your time.

// Main Menu
		if (gameState == 0) {
			batch.begin();
			batch.draw(MainMenuBackground, 0, 0);
			font16.setScale(1, 1);
			font16.draw(batch, "Alpha v1.0.1_02", 10, 20);
			font16.draw(batch, "FPS: ", 950, 20);
			font16.draw(batch,
					Integer.toString(Gdx.graphics.getFramesPerSecond()), 994,
					20);
			font16.setColor(Color.LIGHT_GRAY);
			font16.setScale(2, 2);
			font16.draw(batch, "Start", 845, 450);
			font16.draw(batch, "Options", 830, 380);
			font16.draw(batch, "Exit", 860, 250);
			batch.end();

			// Start Button
			if (Gdx.input.isButtonPressed(Input.Buttons.LEFT)) {
				if (Gdx.input.getX(pointer) > 830
						&& Gdx.input.getX(pointer) < 970
						&& Gdx.input.getY(pointer) > 50
						&& Gdx.input.getY(pointer) < 100) {
					gameState = 2;
				}
			}
			// Options Button
			if (Gdx.input.isButtonPressed(Input.Buttons.LEFT)) {
				if (Gdx.input.getX(pointer) > 810
						&& Gdx.input.getX(pointer) < 990
						&& Gdx.input.getY(pointer) > 120
						&& Gdx.input.getY(pointer) < 170) {
					gameState = 1;
				}
			}
			// Exit Button
			if (Gdx.input.isButtonPressed(Input.Buttons.LEFT)) {
				if (Gdx.input.getX(pointer) > 840
						&& Gdx.input.getX(pointer) < 940
						&& Gdx.input.getY(pointer) > 250
						&& Gdx.input.getY(pointer) < 300) {
					// dispose of all the native resources
					dispose();
					System.exit(0);
				}
			}
		}
		// Options Menu
		if (gameState == 1) {
			batch.begin();
			batch.draw(MainMenuBackground, 0, 0);
			font16.setScale(1, 1);
			font16.draw(batch, "Alpha v1.0.1_02", 10, 20);
			font16.draw(batch, "FPS: ", 950, 20);
			font16.draw(batch,
					Integer.toString(Gdx.graphics.getFramesPerSecond()), 994,
					20);
			font16.setScale(2, 2);
			font16.draw(batch, "Back", 855, 250);
			font16.setColor(Color.LIGHT_GRAY);
			batch.end();
			// Back Button
			if (Gdx.input.isButtonPressed(Input.Buttons.LEFT)) {
				if (Gdx.input.getX(pointer) > 840
						&& Gdx.input.getX(pointer) < 940
						&& Gdx.input.getY(pointer) > 250
						&& Gdx.input.getY(pointer) < 300) {
					gameState = 0;
				}
			}
		}