How can I create a prefab when an object is pressed

Hi, I have a 3d button that I want to create a player with but for some reason I get this error
Assets/Standard Assets/PERSONAL/Player/create redP.js(3,21): BCE0077: It is not possible to invoke an expression of type ‘UnityEngine.GameObject’.

and this is the code I have.

var thePrefab : GameObject; function
OnMouseDown () {


Is this because of the type of function I have?

This is good code:

public var thePrefab : GameObject;
public var spawnPos : Vector3;
function OnMouseDown(){
    Instantiate(thePrefab, spawnPos, transform.rotation);