FullAuto/Single,how to make weapon switch fire?

How to swith auto/single with same key?
I tried this but dnt work…help!!

if(Input.GetKey(KeyCode.X))
  {
     IsFullAuto = true;
  }
  if ( Input.GetKey(KeyCode.X) && IsFullAuto = true)
  {     
       IsFullAuto = false;  
  }

You could make your code work with an additional conditional, but the simple way is as follows:

if(Input.GetKeyDown(KeyCode.X))
{
    IsFullAuto = !IsFullAuto;
}

Note I’ve changed to ‘GetKeyDown’ which only fires on the frame the key is pushed. ‘GetKey’ fires every frame.