Click object

Trying to make a point and click puzzle, tho am having script problems.
When a simple script such as:

--------------------------------Js-------------------------------------

function OnMouseOver() {
if(Input.GetMouseDown(1))
//do thing;
}

Is loaded to more than one object any part of the screen can be selected and it will run.

Apply this JavaScript to your object:
#pragma strict

static var selected : boolean;

function Start () {
selected = false;
}

function OnMouseDown ()
 {
     selected = true;
     Debug.Log("Hi");
 }

The OnMouseDown function means that what’s inside it will run when the object the script is tied to is clicked on. I have made the ‘selected’ variable static so you can check if the object has been pressed on by this script or any other with ThisScript.selected, for example if(ThisScript.selected == true)

Hope this helps