It grabs the rotation value of the player correctly, but it spins the camera around with that value.
I want it to put the same value in the camera’s rotation instead.
this is happening because every frame your adding the players y euler angles to "this"s euler angles. basically say on the first frame your camera has a euler angle z value of 10, and the player has a rotation of on the y 20. the next frame the camera’s z euler angle is 30, and the player is still at 20 y, it will keep doing this every frame so you just constantly spin around… maybe try…
void Update (){
this.transform.localEulerAngles = new Vector3(this.transform.localEulerAngles.x, this.transform.localEulerAngles.y, player.transform.rotation.y);
}