Camera Node not attaching objects

I have been dealing with this problem for months now and I am insansly frustrated. The answer must be so easy but I can’t find it. I have a camNode and want to attach my gun to it so it follows every movement of the cam. Currently, It does not. this is my code:

private CameraNode camNode;
private Node gun;

@Override
public void simpleInitApp() {
    
    camNode = new CameraNode("camNode", cam);
    camNode.setLocalTranslation(cam.getLocation());
    gun = (Node) assetManager.loadModel("Models/AK47.j3o");
    
    camNode.attachChild(gun);
    
    rootNode.attachChild(gun);

}
I have given up so many times trying to get this right. What I am doing wrong? I want the gun to be attached to the camera node just as if I were to attach any other model to a node. It moves and turns with it, execpt for this.

I finally figured out the problem. I have to attach the cam node to the rootNode and set the rotation of the camnode to the rotation of the camera in the update.