error:Unassigned Reference Exeption

Hi, following is my code:

Sorry about that but I have been using the code tags provided in the format doesnot seem to work.Have tried again below.Let me know.

Also is there a easy way to understand configurable Joints?The issue I am having is the joint is acting more lie a bolt and when I rotate one stays stationary while other can rotate around the joint.That is not how I want it.I want both bodies to rotate when either is selected after they get stuck.

var force = -10.00;
var range = 10.00;
var player1 : GameObject;
var player2 : GameObject;
var fixedJoint:HingeJoint;

function OnTriggerEnter (c:Collider) {
if(c.transform.tag=="Cube1"){

print("hello");

                fixedJoint=player1.AddComponent(HingeJoint);
                fixedJoint.useSpring=true;

                fixedJoint.connectedBody = player2.rigidbody;
       print(player1);
    }
}

Your code worked fine for me. Make sure all the needed variables are filled in in your inspector and that the tag reads "Cube1" not "Cube 1" or "cube1".