Play Animation on trigger enter

Hello, i want to play an animation (elevator) when a specific object enters the trigger, but the animation plays when i press the play button.

function OnTriggerEnter (other : Collider)
{

 if(other.tag == "target")
     {
         Animation.PlayMode("lift")
     }
}

If I have Animation.Play it gives me an error:“An instance of type UnityEngine.Animation is required to acces non-static member Play”

Any ideas?

use animation.Play instead of Animation.Play (condition apply…you should have an animation type component attached to lift)