Yes, I know the audio is low. Ignore it. I forgot to raise the volume on it. Sorry about that.



Code:
// FollowBot (C#) by Coldfire202// www.youtube.com/ColdfireTube
// www.coldfiretube.com
using UnityEngine;
using System.Collections;


// Make sure to change the 'FollowBotAI' to whatever your file name is
public class FollowBotAI : MonoBehaviour
{
    // Variables for FollowBot
    Transform Leader;
    float AISpeed = 1;
    float MaxDistance = 10;
    float MinDistance = 2;




    // Use this for initialization
    void Start ()
    {
        // Defines who the bot follows
        Leader = GameObject.FindGameObjectWithTag("Player").transform;
    }
  
    // Update is called once per frame
    void Update ()
    {
        transform.LookAt(Leader);
        AI();
    }


    void AI()
    {
        if (Vector3.Distance (transform.position, Leader.position) >= MinDistance)
        {
            transform.position += transform.forward*AISpeed*Time.deltaTime;


            if (Vector3.Distance (transform.position, Leader.position) >= MaxDistance)
            {
                AIDie();
            }
        }
    }


    void AIDie ()
    {
        // Destroys the bot.
        Destroy(gameObject);
    }
}