I'm having a problem with getting a door to open

[Here’s a link to a video(skip 5 seconds)] (- YouTube)

CODE:

var liukuoviClip : AnimationClip;

private var Door = false;

function Update ()
{

if (Input.GetKeyDown(KeyCode.E) && Door == true)

{

GameObject.Find(“liukuovi”).GetComponent.().Play(“liukuvaovi”);

}

}

function OnTriggerEnter (theCollider : Collider)

{

if (theCollider.tag == “Player”)

{

Door = true;

}

}

function OnTriggerExit (theCollider : Collider)

{

if (theCollider.tag == “Player”)

{

Door = false;

}

}

I don’t know javascript, but I would try something like this:

  1. on the door gameobject, check the “isTrigger”.
  2. make sure that your player’s name in the Hierarchy is “Player”
  3. Go to Edit>Player Input> make a new one by changing the number of inputs. Title it “Action”, and make the positive button ‘e’. **This may even fix the problem entirely. Change the KeyCode.E to “Action”. If this fixes it, ignore everything else. **
  4. Attach this script to the door:

TIPS:
If there is any error in the script, find the line that has the error. If the line with the error has one “=” add another one after it. If it has two, remove one.

using UnityEngine; 
using SystemCollections; 

public class doorOpen : Monobehaviour {

    public AnimationClip liukuoviClip; 
    private bool isOpen = false; 

    void Start () {
        
    }
    
    void Update () {
        
        if (isOpen == true) {
            liukuoviClip.Play(); 
        }
    }   
    
    void OnTriggerStay (Collider other) {
        if (other.gameObject.name == "Player") {
                   if (Input.GetButtonDown("Action")) {
                       isOpen = true; 
            }
        }
    }
}