Arm Look At script Issues (javascript)

I want to have a script that when I set weaponReady to true that the arms will aim to the center of the screen (the lookTarget game object). Unfortunately, I get this:

  1. “NullReferenceException: Object reference not set to an instance of an object” @ line 13

  2. What do I do if my script goes with no errors yet my arms won’t rotate during the animation?

    var lookTarget : GameObject;
    var leftArm : GameObject;
    var rightArm : GameObject;
    var player : GameObject;
    var lookRotate : float;
    var boneControl : GameObject;

    function Update ()
    if (player.GetComponent(PlayerMovement).weaponReady == true)
    lookRotate = boneControl.transform.rotate.y.LookAt(lookTarget);

    	leftArm.transform.rotate = lookRotate;
    	rightArm.transform.rotate = lookRotate;


lookRotate = boneControl.transform.rotate.y.LookAt(lookTarget);

that line is just weird. rotate is not a member of transform. You might have meant rotation but, if you did, you wouldn’t then be able to call the LookAt() method of a float variable (y).

Given that you’re asking about LookAt, which is a function of the Transform component, did you mean: