Why am i getting this error

I have a cube, with a character controller, and when i move on top of a platform, i want it to wait for so manny seconds then it to be destroyed so the player will fall, but it comes up with this error ;

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.

here is the code i am using

if(hit.gameObject.tag == "Dropping")
{
	yield WaitForSeconds(4);
	collider.enabled = false;
	Destroy(hit.gameObject);
	
}

How should i got about this or fix it.

This is crude, but might do the trick…

if(hit.gameObject !=null && hit.gameObject.tag == "Dropping") { yield WaitForSeconds(4); collider.enabled = false; Destroy(hit.gameObject); }

If what @MarkFinn suggests doesn’t work out - it might be because the hit has gone after the 4 second delay. In which case you could try doing var something = hit.gameObject; then the wait, then Destroy(something)