How to make if/else statements progress in order

I have a GUIText that I am clicking that starts out with the text “Lateral Incision”. What I’m aiming for is making it so that every time I click the text, the text changes to the next scripted statement. The problem now is that it starts and immediately jumps to the end. I haven’t found anything helpful in other answers so was just wondering if someone knew what to do? I’m thinking it’s something quite simple, but I can’t figure it out.

Here’s the code:
if (simtext.HitTest(Input.mousePosition) && Input.GetMouseButtonDown(0)){

			simtext.text = ( "Mark Incision");
		}
		if (simtext.HitTest(Input.mousePosition) && Input.GetMouseButtonDown(0)){
			
			 simtext.text = ("Incise Skin & 

Subcutaneous Tissue");
}

		if (simtext.HitTest(Input.mousePosition) && Input.GetMouseButtonDown(0)){
			
			simtext.text = "Perform 'H-cut'; 

watch for peroneal nerve";
}

		if (simtext.HitTest(Input.mousePosition) && Input.GetMouseButtonDown(0)){
			
			simtext.text = "Lateral Incision Complete";
		}
		
		if (simtext.HitTest(Input.mousePosition) && Input.GetMouseButtonDown(0)){
			
			simtext.text = "Medial Incision";
		}
		
		if (simtext.HitTest(Input.mousePosition) && Input.GetMouseButtonDown(0)){
			
			simtext.text = "Mark Incision";
		}
		
		if (simtext.HitTest(Input.mousePosition) && Input.GetMouseButtonDown(0)){
			
			simtext.text = "Expose & Free Muscles";
		}
		
		if (simtext.HitTest(Input.mousePosition) && Input.GetMouseButtonDown(0)){
			
			simtext.text = "Fasciotomy Complete";
		}

This will just make your text read the final value. That is because every condition is the same, so all of them will fire as the code runs down them.

What i would suggest is this, instead of hard coding the text values into the statements, put them into an array. then store a “currentIndex” which will start at 0. Then when the button is pressed you increase the index and set the text. here is an example.

    var myStrings = new Array("String 1","String 2","String 3");
    var currIndex = 0;
    
    
    function Update()
    {
         if(myGUIText.HitTest(Input.mousePosition) && Input.GetMouseButtonDown(0))
         {
              currIndex++;
    
              // here you will want to also check current index to either
              // wrap it back around to 0 or clamp it on the last value
              // based on the array length.
    
              myGuiText.text = myStrings[currIndex];
         }  
    }