I have a small problem. I need to join two booleans in two differen scripts. Look:
First script
var havekey : boolean = false;
function OnTriggerStay (myTrigger : Collider) {
if(myTrigger.gameObject.name == “First Person Controller”){
Debug.Log(“Wanna take the key?”);
if (Input.GetButtonDown (“E”)) {
Debug.Log(“You picked key”);
havekey = true;
Destroy(gameObject.Find(“key”), 3);
}
}
}
Second script
var havekey : boolean;
function OnTriggerStay (myTrigger : Collider) {
if(myTrigger.gameObject.name == “First Person Controller”){
Debug.Log(“Wanna open door?”);
if (Input.GetButtonDown (“E”)) {
Debug.Log(“You re trying to open the door”);
if (havekey == true){
Debug.Log(“You had opend the door”);
gameObject.Find(“door”).animation.Play(“openingdoors”);
}
if (havekey == false){
Debug.Log(“Dont have the key”);
}
}
}
}
So this is it. I have no errors. I just need something like : if first script boolean = true than second script bollean = true and if first script boolean = false then second script bollean = false.
Thank you for help ![]()