array index out of range

using UnityEngine;
using System.Collections;

public class Patrol : MonoBehaviour {
public Transform patrolPoints;
public float moveSpeed;
private int currentPoint;

// Use this for initialization
void Start () {
	transform.position = patrolPoints[0].position;
	currentPoint = 0;

}

// Update is called once per frame
void Update () {
	if (transform.position == patrolPoints[currentPoint].position)
		{
			currentPoint ++;
		
		}
	transform.position = Vector3.MoveTowards (transform.position, patrolPoints [currentPoint].position, moveSpeed * Time.deltaTime);
}

}

You’re not checking if the index entered is larger than your array and so it gives you an error. Just simply add another if statement:

if (transform.position == patrolPoints[currentPoint].position && currentPoint <= patrolPoints.Length)
         {
             currentPoint ++;
         
         }