How do I make this enemy rotate towards the player on one axis?

Hello, I’m making a kind of an endless runner game, and I need help rotating this enemy towards the player in this way:
I need the enemy to rotate to the right if the player is on the enemie’s right side, and to the left if the player is to the enemies left. Can anyone help me out?

to rotate or to flip?

rotation

var delta = player.transform.position - enemy.transform.position;
enemy.rotation = Quaternion.FromToRotation(Vector3.right, delta.normalized);

flip

var delta = player.transform.position - enemy.transform.position;
var scalex = delta.x < 0f? -1f : 1f;
enemy.localScale = new Vector3(scalex, 1f, 1f);

I meant flip, but thank you soooo much for this! I really appreciate it, have a good day, king! :slight_smile: