copy only Y axis rotation of an object?

Hey. i want to copy the rotation of an object (master) i thought it would work like this:

using UnityEngine;
using System.Collections;

public class copyrotation_x : MonoBehaviour {
	
	public GameObject master;

	void Update () {

		transform.rotation = Quaternion.Euler(transform.rotation.x, master.transform.rotation.y, transform.rotation.x);

	}
}

but somehow it doesent copy the rotation? could you tell me why?
thanks!

rotation is a Quaternion, which has 4 elements (x, y, z, w), however they do not correspond to the (x, y, z) of normal 3-axis Euler angles. You need to use rotation.eulerAngles.x to get the values you want.