I can't make my enemy face the player, please help!!!!

,

Hi, I did a bit of coding and can’t figure out why my enemy sprite doesn’t flip and face the player. Basically, I set the target to the player, when the x position of the player is greater than the position of the enemy, the enemy flip using the transform scale. But when I clicked play, I did not see the enemy scale turn negative but stay positive instead. Here is my code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnemyAI : MonoBehaviour
{
    public GameObject player;
    private Transform playerPos;
    private Vector2 currentPos;
    public float distance;
    public float speedEnemy;
    public float minimumDistance;
    private Animator enemyAnim;
    public bool flip;
    public float speed;

    private void Start()
    {
        playerPos = player.GetComponent<Transform>();
        currentPos = GetComponent<Transform>().position;
        enemyAnim = GetComponent<Animator>();
    }

    private void Update()
    {
        Vector3 scale = transform.localScale;

        if (player.transform.position.x > transform.position.x)
        {
            scale.x = Mathf.Abs(scale.x) * -1 * (flip ? -1 : 1);
        }
        else
        {
            scale.x = Mathf.Abs(scale.x) * (flip ? -1 : 1);
        }

        transform.localScale = scale;

        if (Vector2.Distance(transform.position, playerPos.position) < distance)
        {
            if (Vector2.Distance(transform.position, playerPos.position) > minimumDistance)
            {
                transform.position = Vector2.MoveTowards(transform.position, playerPos.position, speedEnemy * Time.deltaTime);
                enemyAnim.SetBool("isFollowing", true);
            }
        }
        else
        {
            if (Vector2.Distance(transform.position, currentPos) <= 0)
            {
                enemyAnim.SetBool("isFollowing", false);
            }
            else
            {
                transform.position = Vector2.MoveTowards(transform.position, currentPos, speedEnemy * Time.deltaTime);
                enemyAnim.SetBool("isFollowing", true);
            }
        }
    }
}

nevermind I found the problem!