My BoxCollider keeps getting destroyed

I am developing a game where the player destroys trees and rocks for resources, but i am a facing problem where everytime i destroy a rock and go to destroy another rock this message shows up.

The object of type ‘BoxCollider’ has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Shatter : MonoBehaviour
{
public GameObject destroyedVersion;

public GameObject MyGreatObject;

void OnTriggerEnter(Collider other)
{
   if (other.CompareTag("Player"))
   {
     StartCoroutine(InstantiateAfterDelay(7f));
     
   }   
}
    IEnumerator InstantiateAfterDelay(float delay)
{
   yield return new WaitForSeconds(delay);
   Instantiate (destroyedVersion, transform.position, transform.rotation);
   Destroy (MyGreatObject);
}

}

The problem must be within your player script, and you must declare an object to hit, in order to damage it. So you must not be clearing out the data from the old object, once it’s been destroyed. So when you go to hit a new object, you still have the old code from the last one active. Either you have it in a List, or just an singular object. You gotta make it null once destroyed, or have a check before declaring it, making sure it’s not null. And it sounds like it’s in your OnCollision method. Because the object itself is already deleted, so it’s script shouldn’t matter.