Array out of Index,array out of index

I am creating Ball Panic Game and when I am shoot the arrow it show error and I can’t figure it out this…please help

""public void ShootTheArrow() {

	if (Input.GetMouseButtonDown (0)) {
		if (shootOnce) {
			shootOnce = false;
			StartCoroutine (PlayerTheShootAnimation ());
			Instantiate(arrows[0], new Vector3 (transform.position.x, height, 0), Quaternion.identity);
		} else if (shootTwice) {
			shootTwice = false;
			StartCoroutine (PlayerTheShootAnimation ());
			Instantiate (arrows [1], new Vector3 (transform.position.x, height, 0), Quaternion.identity);
		}
	}
}"",System.IndexOutOfRangeException: Array index is out of range.

at PlayerScript.ShootTheArrow ()
I am working on a Ball Panic game and I can’t figure it out this error…trying to shoot the arrow.
please help !!

Hey @khannaharsh774,

This error normally indicates that the code is attempting to collect data from an array but the array is either “empty” or not initialized, or your attempting to collect data from a position that is higher the index count of the array.

Use “Debug.Log” to output your array.count or the data assigned to “arrows”. because i suspect that the array will be empty or NULL.

Check that the array is getting populated, and if you need to specify the selection of prefabs in the inspector, do that.