Get Component With Variable Help

So i am trying to set a variable to true in another script using getcomponent but it isnt working and it is giving me an error.

var gunEnabled : String;
var player : Transform;

function OnTriggerStay () 
{
	if (Input.GetKeyDown("e"))
		player.gameObject.GetComponent("WeaponSelect").gunEnabled = true;
}

Why arent i allowed to do something like this and how can i make it work?

I had this problem before, if I am correct. Do this…
player.gameObject.GetComponent(WeaponSelect).gunEnabled = true;

With " " has problems sometimes, so I just never include it

GameObject.Find(“GameObjectsName”).GetComponent(WeaponSelect).gunEnabled = true;