Clicking problem

function Update () {
if (Input.GetButtonDown (“Fire1”)){

animation.Play();

}
}

So i have this script for one of my objects, but its when i click anywhere it just plays, and if i add this script to other objects they all play at once, how do i go about adding to this script so that when you click on the specific object then it plays only that animation

Ive been reading on how to go about this, but cant seem to narrow it down to get this kind of result, any advice??

add separate script for each object or use raycast function.

#pragma strict

function OnTriggerEnter(theObject : Collider){
if(theObject.gameObject.name==“3rd Person Controller”) {
animation.Play();
}
}

function OnMouseDown () {
animation.Play();
}

I have this script im using, but i cant seem to get the animation to play, it seem to work when i var explosion on my other object for a click explode. but not this way for a animation to play when clicked
??
anything im doing wrong?