Open door with key

Hello everyone , once again I need help . I found this script in:

I was very happy so far to test it , then I got frustrated because it did not work , you may have done something wrong , because every time I try to enter the playback mode , I get the famous message (All compille error have to be fixed Can Playmode before you enter ! )
appears on the console this error: ( Assets / Standard Assets / Scripts / Custom Script / KeyScript.js ( 8,18) : BCE0019 : ’ gotKey ’ is not a member of ’ UnityEngine.Transform .’ ) . what to do to fix this? note: I used the last two routings suggested by Block ( burgunfaust ) put a trigger in the other key. Thank you.


Roteiro para a chave

var doorKeyOpens: Transform;
private var gotKey: Boolean = false;

função OnControllerColliderHit (hit: ControllerColliderHit) {

if ( == "chave") {
       print ("Você pegou a chave House");
    doorKeyOpens.gotKey = true;
    Destroy (hit.gameObject);    

Roteiro porta
    var porta: Transforme;
    var gotKey: Boolean = false;
    var angleOpen: int;
    var angleClose: int;
    var speedOpen: int = 1000;
    função OnTriggerStay (outro: Collider) {
        if (door.transform.localEulerAngles.y <angleOpen) {
            door.transform.Rotate (Vector3.up * Time.deltaTime * speedOpen);

doorKeyOpens doesn’t seem to be initialized, and Transform don’t have a gotKey field anyway.