Gun freaks out when pausing game and moving camera

I’m working on a multiplayer game and I have a gun that follows the players mouse input but when I move the camera quickly and pause the game using a pause thing I made and unpause it and aim down the sites the gun is a little off to the side inside of directly in the middle when I aim down the sites. Here is the gun script I made.
using UnityEngine;
using System.Collections;

public class GunControlScript : MonoBehaviour {

	//Variables Start___________________________________

	public Transform player;
	public Transform cameraHead;

	private MouseLook mouseLook;
	private float yRotation;
	private float xRotation;

	private float targetXRotation;
	private float targetYRotation;

	private float targetXRotationV = 0.0f;
	private float targetYRotationV = 0.0f;

	private float rotateSpeed = 0.03f;

	private float holdSide = 0.25f;
	private float holdHeight = -0.08f;

	private float racioHipHold = 1;
	private float hipToAimSpeed = 0.1f;
	private float racioHipHoldV = 0.0f;

	//For camera aim zoom
	private float defaultCameraFOV = 60;
	private float zoomFOV = 20;
	private float racioZoom = 1;
	private float racioV = 0.0f;
	private float racioZoomSpeed = 0.1f;

	private Camera playerCamera;

	//Variables End_____________________________________

	// Use this for initialization
	void Start () {
		if(networkView.isMine == true) {
			player = transform.parent;
			cameraHead = player.transform.FindChild("CameraHead");
			playerCamera = Camera.main;
		}
		else {
			enabled = false;
		}
	}
	
	// Update is called once per frame
	void Update () {
		mouseLook = cameraHead.GetComponent<MouseLook> ();
		if(Screen.lockCursor == true) {

			if(Input.GetButton("Fire2")) {
				racioHipHold = Mathf.SmoothDamp(racioHipHold, 0, ref racioHipHoldV, hipToAimSpeed);
				racioZoom = Mathf.SmoothDamp(racioZoom, 0, ref racioV, racioZoomSpeed);
			}
			if(Input.GetButton("Fire2") == false) {
				racioHipHold = Mathf.SmoothDamp(racioHipHold, 1, ref racioHipHoldV, hipToAimSpeed);
				racioZoom = Mathf.SmoothDamp(racioZoom, 1, ref racioV, racioZoomSpeed);
			}

			yRotation += Input.GetAxis ("Mouse X") * mouseLook.sensitivityY;
			xRotation -= Input.GetAxis ("Mouse Y") * mouseLook.sensitivityX;

			targetXRotation = Mathf.SmoothDamp(targetXRotation, xRotation, ref targetXRotationV, rotateSpeed);
			targetYRotation = Mathf.SmoothDamp(targetYRotation, yRotation, ref targetYRotationV, rotateSpeed);
			
			xRotation = Mathf.Clamp(xRotation, -83, 83);
		
			transform.position = cameraHead.transform.position + (Quaternion.Euler(0, yRotation, 0) * new Vector3(holdSide * racioHipHold, holdHeight * racioHipHold, 0));
			transform.rotation = Quaternion.Euler(targetXRotation, targetYRotation, 0);
			
		}
		
		playerCamera.fieldOfView = Mathf.Lerp(zoomFOV, defaultCameraFOV, racioZoom);

	}

}

Here’s screenshots uploaded on imgure Normal non aiming - Album on Imgur PLEASE Help me figure this out. I’ve been trying to figure it out for a few days and its driving me crazy. Thank you to anyone who can help me :slight_smile:

Try changing around your mouse look function to pause while you aim in and add a different part to the script for mouse control while aimed in.