NullReferenceException: Object reference not set to an instance of an object

Code Instantiates just fine and the object is placed perfectly, but it does not get set as child of helmNode. (returns the error at line 15)

What am I doing wrong here? Im sure its painfully obvious, just trying to learn the engine and Js

#pragma strict
private var helmMesh : GameObject;
var helmNode : Transform;
var helm : Transform;


function Start () {

}
function OnGUI()
{
	if (GUI.Button (Rect (20,40,80,20), "EQUIP")) {
		transform.Find("HELMEQUIP");
		helmMesh = Instantiate(helm, helmNode.transform.position, Quaternion.identity) as GameObject;
		helmMesh.transform.parent = helmNode.transform;
		helmMesh.transform.rotation = new Quaternion (0, 0, 0, 0);
		
	}
}
function Update () {

}

Did you set helmNode in the inspector?

helm and helmNode have both been set in the inspector

Your instantiating a Transform and trying to store the reference in a GameObject. I don’ think it likes mixing types like that :wink: