Attached Weapon doesn't track bone position

I have a weapon Skeletal Mesh which I attach to the character mesh via Blueprint.The weapon gets attached but it doesn’t seem to be in the socket position and it also doesn’t transform relative to the socket position.It is completely static.It works fine if I attach it to the socket explicitly via Skeleton editor.
Here is my blueprint:

UPDATE:

After several experiments it seems like the issue comes from the rifle component creation nodes flow.I have no idea how to spawn the mesh dynamically other than what I did here in the graph ,but if I just throw the mesh of the rifle directly into "Components of the blueprint and attach it to “Attach To”->Target ,then it is snapped into socket correctly.

No one can help here?

Hm, have you tried using “SnapToTarget” as Attach Type?

In your BP you are also not using your Cast Node.

Yeah,doesn’t work either.But I suspect maybe the problem is in Weapon creation node.I just tried to add some mesh by drag and drop into Components window ,then attached it and it worked fine.How should I correctly spawn new skeletal mesh in the blueprint?

I solved it,I didn’t need “GetChildComponent” node.That one probably returned the mesh which was later failing during the cast.I connected return value from the Rifle creation node to the target of “Attach To” and it snapped to the right place.