How do you get iTween to properly implement PutOnPath command?

I am trying to use iTween to get a gameObject to follow a path and end up in a specific location. I keep getting an error which is “IndexOutOfRangeException: Array index is out of range.”

Any help on this would be greatly appreciated!
Here is my code

public class MosquitoCamPath : MonoBehaviour {

float percentsPerSecond = 0.02f;
float currentPathPercent = 0.0f;
public Vector3[] path;
// Use this for initialization
void Start () {

    
    Vector3[] path = new Vector3[5];
    path[0] = new Vector3(5, 45, 5);
    path[1] = new Vector3(8, 30, 16);
    path[2] = new Vector3(15, 20, 20);
    path[3] = new Vector3(8, 15, 22);
    path[4] = GameObject.Find("Mosquito Model(Clone)").GetComponent<Pathing>().loc;

   

}

// Update is called once per frame
void Update () {

    currentPathPercent += percentsPerSecond * Time.deltaTime;

    iTween.PutOnPath(gameObject, path, currentPathPercent);
    iTween.LookTo(gameObject, GameObject.Find("Mosquito Model(Clone)").GetComponent<Pathing>().loc, 15);
}

}

My first thought is that your currentPathPercent can go above 1.0f. When that happens, you might find that iTween is searching outside of the path points you’ve passed in, which would generate the error you’re seeing.

Try clamping the currentPath to between 0 and 1 (either use Mathf.Clamp01() or just check if (currentPathPercent > 1.0f) { currentPathPercent -= 1.0f; }