AI?

I’ve for so long been trying to make an AI that can follow the player and if player does something it would stop

That’s rather vague. What code have you written and what aspects are you struggling with?

Create a loop in your AI class that switches between a few basic states: Idle, Attacking, Moving, Fleeing, using switch to go between them, then work on deciding what they will do in each state, and how you will transition from different states.

Create an enum to determine AIState:

enum AICommand
{
   Idle, Attack, Move, Flee
};

AICommand aiCommand = AICommand.Idle;

then in the Update function switch between aiCommand’s possible states. This will get you started

void Update()
{
     switch(aiCommand)
     {
              case (AICommand.Idle):
              {
                    //Do idle stuff
                    //Look for targets
                    break;
              }
              case (AICommand.Attack):
              {
                    //Attack current target, follow if out of range
                    break;
              }
             //more cases
     }
}