how do i rotate the player with the camera using this code i made.

private const float Y_ANGLE_MIN = 0.0f;
private const float Y_ANGLE_MAX = 50.0f;
public Quaternion rotacion = Quaternion.identity;
public Transform lookat;
public Transform camtransform;
private Camera cam;
public float distance = 40.0f;
public float currentX = 0.0f;
public float currentY = 0.0f;
public float sensivityx = 4.0f;
public float sensivityy = 4.0f;

// Use this for initialization
private void Start () {
	camtransform = transform;
	cam = Camera.main;
}

private void Update () {
	currentX += Input.GetAxis ("Mouse X");
	currentY -= Input.GetAxis ("Mouse Y");
	currentY = Mathf.Clamp (currentY, Y_ANGLE_MIN, Y_ANGLE_MAX);	
}
void LateUpdate () {
	Vector3 dir = new Vector3 (0, 0, -distance);
	Quaternion rotation = Quaternion.Euler (currentY, currentX, 0);
	camtransform.position = lookat.position + rotation * dir;
	camtransform.LookAt (lookat.position);
}

You could add a public field like

GameObject playerObject;

that you set in the editor. Then in Update, just call

playerObject.transform.Rotate (0, Input.GetAxis("Mouse X"), 0);

Another way to do all this is to just rotate your Player object in its own script (basically the same as what I wrote above), and use the new Cinemachine system to handle the camera. Its a free download and there’s even a Camera behavior for this exact thing.

thanks bro