AI keeps attacking objects that are not player.

void Update()
{
transform.LookAt(thePlayer.transform);
if (attackTrigger == false)
{
enemySpeed = 0.01f;
theEnemy.GetComponent().Play(“walk”);
transform.position = Vector3.MoveTowards(transform.position, thePlayer.transform.position, enemySpeed);
}
if (attackTrigger == true && isAttacking == false)

        {
            enemySpeed = 0;
            theEnemy.GetComponent<Animation>().Play("attack");
            StartCoroutine(InflictDamage());
        }

    }

    void OnTriggerEnter()
    {
        attackTrigger = true;
    }

    void OnTriggerExit()
    {
        attackTrigger = false;
    }

The AI keeps attacking objects and they will attack ramps whenever they go up them, causing the player damage. Is there a reason to solving this?

You need to check what has activated the TRrigger.

void OnTriggerEnter(Collider other)
     {
          if (other.gameObject==thePlayer)
         {
         attackTrigger = true;
         }
     }

So only activates it if is the player, Now is triggering in all other colliders!