Set certain axis of rotation to 0

Hey, I keep running into simple problems with rotation, just can’t get my head around quatonians and eulers and whatnot…
I’m using transform.LookAt(target) But I want to only rotate around the Y axis. What I tried was this:
transform.LookAt(target);
transform.rotation = Quaternion.Euler(new Vector3(0,transform.rotation.y,0));
Object is not rotating at all however when I do this :confused:
Sorry, I imagine this is very simple lol, thanks for your time.

This post should get you what your after its topic of conversation is leveling out an object after rotation such as collision but I would expect you could apply the same practice. If you are trying to clamp your rotation to a specifc axis I am doing somthing similar in a project I am working on now where I only want to rotate around the z axis; see below code which includes the stablization/level out bits

rigidbody.drag = positionalMovement.ComputeDrag(thrust, rigidbody.velocity);
rigidbody.angularDrag = rotationalMovement.ComputeDrag(turn, rigidbody.angularVelocity);
			
thrust *= (thrust > 0.0) ? positionalMovement.positiveAcceleration : positionalMovement.negativeAcceleration;
turn *= (turn > 0.0) ? rotationalMovement.positiveAcceleration : rotationalMovement.negativeAcceleration;
			
float stability = 1f;
float speed = thrust;
			
if(speed > 0)
{
	Vector3 predictedUp = Quaternion.AngleAxis(
	            rigidbody.angularVelocity.magnitude * Mathf.Rad2Deg * stability / speed,
	            rigidbody.angularVelocity) * transform.up;
				
	Vector3 torqueVector = Vector3.Cross(predictedUp, new Vector3(0f,0f,-1f));
	//torqueVector = Vector3.Project(torqueVector, transform.up);
      	rigidbody.AddTorque(torqueVector * speed * speed);
}
			
rigidbody.AddRelativeTorque(new Vector3 (0f, turn * Time.deltaTime, 0f), ForceMode.VelocityChange);
rigidbody.AddRelativeForce (forwardDirection * thrust * Time.deltaTime, ForceMode.VelocityChange);	

In the above I am using rigidbody by the way ( I am rotating left or right when A or D is pressed around the local Y which in this case is the world Z