IndexOutOfRangeException error

Can’t find nor solve what is causing the error.

IndexOutOfRangeException: Array index is out of range.Arrays.OnTriggerStay(UnityEngine.Collider other) (at Assets/Scripts/Arrays.cs:89)

This is the script
using UnityEngine;
using System.Collections;

public class Arrays : MonoBehaviour
{
	public int numSelectors;
	public int xPosition; //must be rounded to the nearest 10
	public int yPosition;
	public int zRotation;
	public GameObject[] destruct;
	public GameObject[] selectorArr;
	public GameObject selector; //selected in the editor
	public GameObject wirePrefab;
	public bool verticalDirection;
	public bool leftKeyPressed;
	public bool rightKeyPressed;
	public string deactivationName;
	public bool wireSpawned;
	public int total;


	void Update () {
		if (Input.GetKeyDown (KeyCode.LeftArrow)) {
			//Debug.Log ("left key was pressed");
			leftKeyPressed = true;
			//Debug.Log ("true");
		}
		if (Input.GetKeyUp (KeyCode.LeftArrow)) {
			//Debug.Log ("left key was released");
			leftKeyPressed = false;
			//Debug.Log ("false");
		}
		
		if (Input.GetKeyDown (KeyCode.RightArrow)) {
			//Debug.Log ("right key was pressed");
			rightKeyPressed = true;
			//Debug.Log ("true");
		}
		if (Input.GetKeyUp (KeyCode.RightArrow)) {
			//Debug.Log ("right key was released");
			rightKeyPressed = false;
			//Debug.Log ("false");
		}
	}


	void Start()
	{

	}

			void OnTriggerStay(Collider other){

		selectorArr = new GameObject[numSelectors];
		for (int i = 0; i < numSelectors; i++) {
			GameObject[]destruct = GameObject.FindGameObjectsWithTag (deactivationName);
			int destructCount = destruct.Length;

			if (other.gameObject.tag == "Player") {
				selector.gameObject.tag = deactivationName;
			if (rightKeyPressed == true) {
					if (wireSpawned == false) {

					//if (GameObject.Find ("Pfb_PPlateOFF").GetComponent<PresurePlate> ().doorSpawned) { //will check if true
			if (verticalDirection == false) {
			GameObject go = Instantiate(selector, new Vector3((i * 16f) + xPosition, yPosition, -6), Quaternion.Euler(0,0,zRotation)) as GameObject;
			go.transform.localScale = Vector3.one;
			selectorArr *= go;*
  •  	}*
    
  •  	if (verticalDirection == true) {*
    

_ GameObject go = Instantiate(selector, new Vector3(xPosition, (i * 16f) + yPosition, 0), Quaternion.Euler(0,0,zRotation)) as GameObject;_

  •  		go.transform.localScale = Vector3.one;*
    

_ selectorArr = go;_

* }*
* if (destructCount > total) {*
* wireSpawned = true;*
* //Debug.Log(“successful spawn”);*
* }*
* }*
* }*
* }*

* if (leftKeyPressed == true) {*
* if (other.gameObject.tag == “Player”) {*
* //if (wireSpawned == true){*

_ Destroy (destruct );
* wireSpawned = false;
//foreach (GameObject goHolder in destruct) Destroy(goHolder);
//Destroy(go);
//Debug.Log(“successful despawn”);*_

* //}*
* }*
* }*

* }*
* }*

* void OnTriggerExit(Collider other){*
* selector.gameObject.tag = (“wire”);*
* }*

}
Assistance and advices would be appreciated.
Thanks

On the line with Destroy (destruct *); you’re trying to access the array with an index greater than the length of the array so it’s throwing the error. To solve it try checking if i < destruct.Length before trying to access it.*