Smooth Rotation A long Y Axis (Dampening)

I’ve been working on a movement script for a character. I have a standard camera script where you can right click to rotate, scroll wheel to zoom etc etc. Well, in the movement script I have a line on if the player holds the right mouse button down and rotates the camera, the player will face the direction the camera is facing so that you can rotate the camera to actually rotate the player as well. The line I have works perfectly fine, but I want it to be smoothened out instead of actually it turning instantly with the camera. So basically i’m trying to dampen the rotation. I don’t know how to exactly carry this out, but would appreciate any help. Here is the line to control the rotation with the camera.

Thanks in advance!

	void Update () 
	{
		if (!IsDead)
		{
			if (Input.GetMouseButton(1))
			{
				transform.rotation = Quaternion.Euler(0,Camera.main.transform.eulerAngles.y,0);
			}
		}

	}

If you want to make rounded movement of the camera in your script, simply replace a line:

 transform.rotation = Quaternion.Euler(0,Camera.main.transform.eulerAngles.y,0);

The next line:

 transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(0,Camera.main.transform.eulerAngles.y,0), 2*Time.deltaTime);

Here, 2*Time.deltaTime is speed rotation. I hope it to you will help.