Pathfind - Scripting help

How can i make an object follow me when i get closer.
Like this:

If(Distance < MinDistance){
// Follow player//
}

I rejected you first question which was couple words long where you just brutally asked for script.

Unity answers is for asking specific questions, not leeching free work, that is scripts (but of course everything depends on how you ask and how much you know already).

Also, i think you are wrong with terms here, i believe you asking for AI script “help”, not path finding.

Anyway, here is a very very simple piece of code which will start you going.

//Place this on your AI

public Transform objectToFollow; //drag your player here in inspector
float speed = 2f; //AI follow speed

void Update(){
    float distance = Vector3.Distance (transform.position, objectToFollow.position);

    if(distance < 4){
        transform.position = Vector3.MoveTowards(transform.position, objectToFollow.position, speed*Time.deltaTime);

        transform.LookAt(objectToFollow.position);
    }
}