disable script on trigger

Hi, I’m trying to make it so after I press the e button on an object it disables the script that was used but it’s not working when I try it

  if(Input.GetKeyDown("e"))
			{
				(GetComponent("lever2.cs") as MonoBehaviour).enabled = false;
			}
		}

or at least tell me a way to disable all keys too.

Use the Destroy function.

Destroy function