The BP_Rifle is attached to the WeaponSocket OK and when in the Idle animation is aligned reasonably well. However, when moving forwards or backwards the gun remains level and straight ahead and doesn’t appear to move with the slight 'left-to-right arm motion in the forward and backwards animation.
The WeaponSocket is attached as per the picture below:
EDIT: So I found the issue. I had spelled “WeaponSocket” incorrectly in the call to “Gun->AttachToComponent(GetMesh(), FAttachmentTransformRules::KeepRelativeTransform, TEXT(“WeaponSocket”));” Issue Closed.