Changing Rotations of objects with variables

Hello! I have a problem : I’m trying to rotate and object using variables and it’s not working. Can someone please tell me what I am doing wrong?

    private GameObject aHead;
    private GameObject aBody;
           private Vector3 headRotation;
    private Vector3 bodyRotation;
                bodyRotation = aBody.transform.rotation; //Get Body Rotation
                headRotation = bodyRotation; // Set Head Rotation
                aHead.transform.localRotation = headRotation; // Rotate Head to match body

Lines 5 - 7 happen in an Update() function