Commands affecting rotation not working

Evening, guys.

Currently, I’m attempting to make it so that if the player has an enemy targeted, they’ll automatically turn in their direction when attacking.

To achieve this, I’ve got a gameobject (called targetLooker) that follows them, and looks at the current target via transform.LookAt, and this is working just fine. The second piece is a line in the basic movement script that should make the player character’s Y rotation equal that of the targetLooker’s if they’re targeting an enemy and attacking:

if(PlayerPos.hasTarget && isAttacking || isSkill)
		 transform.eulerAngles = Vector3(0, -targetLooker.rotation.y, 0);

This is working, but not as it should be. Instead, the player character’s Y rotation only kind of equals the targetLooker’s. Say, for example, that the player character is facing away from the current target, and the targetLooker is facing them nicely. If I attack, the player only turns halfway toward their supposed direction, and is facing to the left of the target instead.

Any idea what’s wrong? In addition to eulerAngles I’ve tried Quaternion, Rotate, and rotation, but those aren’t working either.

transform.rotation is a 4-dimensional quaternion, and rotation.y isn’t the y axis. You want eulerAngles rather than rotation. Anyway you probably want to use LookAt rather than trying to directly set angles.