Temporary variable (516495)

HI
I wrote this code:

public GameObject player;
	public Vector3 posX;
	public Vector3 posY;
	public float zPos;
	
	void Update () 
	{
		transform.position.y = player.transform.position.y;
		transform.position.x = player.transform.position.x;
		transform.position.z = zpos;
	}

but its keep telling me that:Assets/Scripts/Camerastyle.cs(13,27): error CS1612: Cannot modify a value type return value of `UnityEngine.Transform.position’. Consider storing the value in a temporary variable
How can I fix it?
thx for the help

Vector3 pos = transform.position;
pos.y = ....;
pos.x = ...;
pos.z = ....;
transform.position = pos;

thx for the help