how to instantiate object when I click

I'm trying to get a 3d object to instantiate whenever a 2d plane is clicked. Here is the code:

var wasClicked: boolean = false;

var redBrick: Rigidbody;

function onMouseOver() {

    if(Input.GetMouseButtonDown(0)){
        wasClicked = true;

        var tempRedBrick: Rigidbody;

        tempRedBrick = Instantiate(redBrick, transform.position, transform.rotation);

        }
}

The code worked on previous game I was making, but I was instantiating 2d planes with each click. Can anyone give me a hand?

1) Use onmousedown event on the play instead 2) Save your GameObject instead of a rigidbody

var redBrick: Rigidbody;
var redbrickObj : GameObject; // This is where you store your prefab

function onMouseDown() {

        var tempRedBrick: Rigidbody;

        tempRedBrickOBj = Instantiate(redbrickObj , transform.position, transform.rotation);
         tempRedBrick =  redbrickObj.rigidbody;

}