Align weapon sight with crosshair

Hello,
I am creating a multiplayer FPS. I have been trying for quite a long time to figure out how to align my crosshair when the player is not aiming with my weapon sight when the player is aiming.

My player can either :

  • Not be aiming: in that case, it doesn’t really matter where the gun is pointing, because I am shooting my bullet in the direction the player is looking at.
  • Be aiming: in that case, I want my gun to be targeting exactly what the crosshair was pointing at before aiming.

I could attach my weapon to my camera but it feels pretty dirty and my client’s camera rotation does not replicate properly (for other players, the camera is following the head animation and rotates on the X-axis instead of staying horizontal as it is for the local player).
I also thought about attaching my weapon directly to my pawn, but there are many issues with this approach as it would mean updating the weapon position on tick to match the head pitch and position.

Anyway, I feel that there are way better ways to do this, but I can’t find them.

Any help would be appreciated!

Thanks!