Drawers to open and close

Hi i am newb at Unity scripting and i tried getting door open scripts working on a chest of drawers which has 3 drawers. I made an animation to open /close on timeline and I tried this script. I attached this script to MT gameobject, the game object itself and even the camera…Why does’nt it work. HELP!!

private var doorIsOpen : boolean = false;
var door : GameObject;
function OnTriggerEnter(collision : Collider) 
{ 
    if ((collision.gameObject.tag =="DrawerAss1") && (doorIsOpen = false))
    {
        door.animation.Play("OpenDrawer"); 
        doorIsOpen = true;
    }
}

function OnTriggerExit(collision : Collider)
{
    if ((collision.gameObject.tag == "DrawerAss1") && (doorIsOpen = true))
    {
        door.animation("CloseDrawer").speed = -1.0;
        doorIsOpen = false; 
    }  
}

I even tried this from Unity script ref

//Plays an animation only if we are not playing it already.
function OnMouseEnter() {
    if (!animation.isPlaying)
        animation.Play();

nada…

In your script, in the if statements, change:

if ((collision.gameObject.tag =="DrawerAss1") && (doorIsOpen = false)) {

to

if ((collision.gameObject.tag =="DrawerAss1") && (doorIsOpen == false)) { 

You missed out the extra ‘=’.

Hope this helps,

Ollie