need help with instantiate'ing a Rigidbody

I am new to unity so i tried to instantiate an prefab'ed gameObject which is called "prefabcyl" and it is a Rigidbody. When i use this script:

var turn_yaw_y_axis=0.0;
var z=0.0;
var spawn=0.0;
function Update () {
if (spawn>0){
var clonecyl : Rigidbody;

it shows this error: "Assets/game for KONGREGATE/script for Main Cam.js(12,21): BCE0023: No appropriate version of 'UnityEngine.Object.Instantiate' for the argument list '(UnityEngine.Transform, UnityEngine.Vector3)' was found." Is there a way to fix it? I am using javascript and the script is placed on "MainCamera", a camera.

Hi Matthew,

Instantiate requires either a single parameter (the object to instantiate), or 3 (the object, the Vector3 position, and the Quaternion rotation).

Thus, if you simply want to instantiate at a given position, you should write this:

clonecyl = Instantiate( clonecyl );
clonecyl.transform.position = transform.position + Vector3( 0, 0, 7 )

Also, I suppose that after this you will get an error because the prefab can't be found. In this case, you should use Resources.Load instead of your instantiate method:

clonecyl = Instantiate( Resources.Load( "clonecyl" ) );