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?