Gui button for attachment

So what i want to do is be able to press a gui button on my screen ( which will say ACOG ) , and when i click it the acog renderer will be enabled , and the iron sights will be turned off , but when i click the acog button instead of 2 buttons it will say iron sights where the button acog was. heres the code :

var attachmentOne : GameObject;
var attachmentTwo : GameObject;

function Update () 
{
  if ( Input.GetButton("Disable1"))
  {
        attachmentOne.renderer.enabled = false; 

  }         
  if ( Input.GetButton("Disable2"))
  {
        attachmentTwo.renderer.enabled = false; 

  }              
            
}

I suggest you spend a bit of time studying the GUI system since you are asking about GUI but your script does not use GUI. [Here is one link with some basic examples.][1] As for your question:

var attachmentOne : GameObject;
var attachmentTwo : GameObject;

private var strings : String[] = ["ACOG", "iron sights"];
private var i = 0;

function OnGUI() {
	if (GUI.Button(Rect(50,50, 100, 50), strings*)) {*
  •  i = (i + 1) % 2;*
    
  •  attachmentOne.renderer.enabled = (i == 0);*
    
  •  attachmentTwo.renderer.enabled = (i == 1);*
    
  • }*
    }
    [1]: Unity - Manual: IMGUI Basics