If statement inside Coroutine firing without meeting the conditions

I have two coroutines, one for Loading and another for Saving, both corutines are pretty much the same, in fact I copies and pasted one to create another, yet one of them does stuff without meeting the conditions (in this case, pressing the “attack” button), the loading coroutine just loads the first save slot without me ever pressing the attack button.

I cant post the whole code as is quite large but here are the coroutines

IEnumerator LoadCo(){
		GameObject GameManager = GameObject.FindGameObjectWithTag("GameManager");
		SaveSystem _SaveSystem = GameManager.GetComponent<SaveSystem>();
		if (Input.GetButtonDown("attack1") == true){
		audio.PlayOneShot(SelectMenu);
		_SaveSystem.Load(MenuString);
		yield return new WaitForSeconds(1);
				}
	}

IEnumerator SaveCo(){
		GameObject GameManager = GameObject.FindGameObjectWithTag("GameManager");
		SaveSystem _SaveSystem = GameManager.GetComponent<SaveSystem>();
		if (Input.GetButtonDown("attack1") == true){
		audio.PlayOneShot(SelectMenu);
		_SaveSystem.Save(MenuString);
		yield return new WaitForSeconds(1);
				}
	}

And a switch I have, this is all the relevant code as the rest is OnGUI stuff.

switch(MenuIndex){
		case -1:
		MenuIndex = 3;
		break;
		case 0:
		if (PauseMenuInt == 0){
		MenuString = "Resume";
		if (Input.GetButtonDown("attack1") == true){
		audio.PlayOneShot(SelectMenu);
		_GameManager.MenuBool = false;
				}
			}
		if (PauseMenuInt == 1){
		MenuString = "Slot 1";
		StartCoroutine (SaveCo());
			}
		if (PauseMenuInt == 2){
		MenuString = "Slot 1";
		StartCoroutine (LoadCo());
			}
		break;
		case 1:
			if (PauseMenuInt == 0){
		MenuString = "Save";
		if (Input.GetButtonDown("attack1") == true){
		audio.PlayOneShot(SelectMenu);
		PauseMenuInt = 1;
				}
			}
		if (PauseMenuInt == 1){
		MenuString = "Slot 2";
		StartCoroutine (SaveCo());
			}
		if (PauseMenuInt == 2){
		MenuString = "Slot 2";
		StartCoroutine (LoadCo());
			}
		break;
		case 2:
		if (PauseMenuInt == 0){
		MenuString = "Load";
		if (Input.GetButtonDown("attack1") == true){
		audio.PlayOneShot(SelectMenu);
		PauseMenuInt = 2;
			}
				}
		if (PauseMenuInt == 1){
		MenuString = "Slot 3";
		StartCoroutine (SaveCo());
			}
		if (PauseMenuInt == 2){
		MenuString = "Slot 3";
		StartCoroutine (LoadCo());
			}
		break;
		case 3:
		if (PauseMenuInt == 0){	
		MenuString = "Exit";
		if (Input.GetButtonDown("attack1") == true){
		audio.PlayOneShot(SelectMenu);
		Application.Quit();
						}
			}
		if (PauseMenuInt == 1){
		MenuString = "Back";
		if (Input.GetButtonDown("attack1") == true){
		audio.PlayOneShot(SelectMenu);
		PauseMenuInt = 0;
			}
			}
		break;
		case 4:
		MenuIndex = 0;
		break;
		}
		if (Input.GetButtonDown("Digipad_down") == true){
			audio.PlayOneShot(MenuFocus);
			MenuIndex += 1;
			}
		if (Input.GetButtonDown("Digipad_up") == true){
			audio.PlayOneShot(MenuFocus);
			MenuIndex -= 1;
			}

I dont know whats wrong, please help me.

In order for this to work, you will need to have a coroutine that is specifically waiting for Input. In my experience, conditions inside coroutines work best when they are while loops. Personally, I never tried to structure one like what you have. However, I dug up this article I had in my favorites from years ago that might help you out: Coroutines: Waiting for Input

I’m sure that should get you well on your way to accomplishing this.

Ok I found the solution, instead of using coroutines I made an if statement and simplified the switch This is the IF I made.

if (Input.GetButtonDown("attack1")== true){
			
				if (MenuString == "Slot 1" || MenuString == "Slot 2" || MenuString == "Slot 3"){
				audio.PlayOneShot(SelectMenu);
					if (PauseMenuInt== "Save_menu"){
       				_SaveSystem.Save(MenuString);
						}
					if (PauseMenuInt== "Load_menu"){
       				_SaveSystem.Load(MenuString);
						}
				}
			
			if (MenuString == "Save"){
				audio.PlayOneShot(SelectMenu);
				PauseMenuInt = "Save_menu";
			}
			if (MenuString == "Load"){
				audio.PlayOneShot(SelectMenu);
				PauseMenuInt = "Load_menu";
			}
			
			if (MenuString == "Back"){
				audio.PlayOneShot(SelectMenu);
				PauseMenuInt = "Pause";
			}
			if (MenuString == "Exit"){
				audio.PlayOneShot(SelectMenu);
				Application.Quit();
			}
			if (MenuString == "Resume"){
				audio.PlayOneShot(SelectMenu);
				_GameManager.MenuBool = false;
			}
		}

It basically has every possible outcome of pressing the “attack” button, in the switch I just deleted every reference to inputs. Thanks all for your time.