Having trouble keeping Weapon on two sockets

Hi everyone right now I am working on a thirdperson shooter game but I have seem to have come across a problem with attaching the weapon into the sockets. When I go into certain poses when aiming the right hand does not seem to align correctly with my weapon. Is there any way to fix this.

-Thanks

Hi again everyone I just figured out a solution weeks ago. I found a cool method that is called IK and it took a while to figure out how it works but hey it works!