Big problem

public GameObject[] gos;
private void Start()
  {
gos = GameObject.FindGameObjectsWithTag("Player");
  }

public void Movement()
{
      Vector3 direction = gos[0].transform.localPosition - transform.localPosition;
      Debug.Log("Side: " + direction.x);

       if (direction.x > 0 && anim.GetBool("InCombatt") == true)
            {
               sprite.flipX = true;
            }
       else if (direction.x < 0 && anim.GetBool("InCombatt") == true)
            {
              sprite.flipX = false;
            }

       Vector3 directio = gos[1].transform.localPosition - transform.localPosition;
       Debug.Log("Side: " + directio.x);
       if (directio.x > 0 && anim.GetBool("InCombatt") == true)
            {
              sprite.flipX = true;
            }
              else if (directio.x < 0 && anim.GetBool("InCombatt") == true)
           {
             sprite.flipX = false;
           }

       void Dial()
       {
         float distance = Vector3.Distance(transform.localPosition, gos[0].transform.localPosition);
           // Debug.Log("Distance: " + distance);
           if (distance > 4.0f)
          {
           isHit = false;
           anim.SetBool("InCombat", false);
          }
       }
      void Diatt()
      {
         float distanc = Vector3.Distance(transform.localPosition, gos[1].transform.localPosition);

         // Debug.Log("Distance: " + distanc);
         if (distanc > 4.0f)
         {
           isHit = false;
           anim.SetBool("InCombat", false);
         }
      }


         if (direction.x * direction.x > directio.x * directio.x)
         {
             Diatt();
         }else { Dial(); }
}

this is my problem ,i use array to calculate both distances and directions between two player and one enemy,but when enemy is InCombat enemy consider correct distance but flip to the other side ,because i think it consider the direction of other player,help,( for one player works)

Done

Does you code really look like that in Visual Studio?

Here, a video about convention and syntax in scripting. The part about indentation is at 2:30:

https://www.youtube.com/watch?v=0mks0QaWCNQ

Maybe more information about the game would help. 2 players and 1 enemy? Is the posted script attached to the enemy? Also the posted script seems to be incomplete or when are the methods called, missing update etc?

the code is correct now, yes there are two player and one zombie ,the zombie should combat with both enemies but do not work,(read previous about flip and…) the script posted is attached to enemy

If you say your script compiles then check your posted script again. There are many undeclared variables, methods inside method. Also there is no information when and how is the Movement() called. Try to post your script again by copying it directly from your script editor and give some more information about what is happening and what are you trying to achieve. At this point it is really difficult for someone to help you out based on the information you have given.

i do not know what you need,this is all….Movement is called like in the script….i need a way to do not consider direction or directio ,in this way enemy flip correctly,when direction is more near than directio ,do not consider directio and the same for the opposite