Trying to delay code, nothing works.

I know there are already a TON of these but nothing is working and I REALLY want to accomplish this so please help me friends.

So what I am trying to make is a platform that when the player touches it the platform will disappear after a few seconds, so what I do is I make one of the IEnumerator wait function thingies everyone says to make but when I call it nothing happens. The platform just disappears immediately.

Here is the code, how can I fix?:

void OnTriggerEnter(Collider other) {
        if (other.gameObject.CompareTag("Fall"))
        {
            StartCoroutine(Wait());
            other.gameObject.SetActive (false);
        }
}

    IEnumerator Wait()
    {
        while (true)
        {
            yield return new WaitForSeconds(30000000);

        }
    }

Move the sentence you want to delay to the Wait method after the WaitForSeconds sentence. Pass the other collider as parameter. Also, there’s no need for the “while (true)” loop:

void OnTriggerEnter(Collider other) 
{
    if (other.gameObject.CompareTag("Fall"))
    {
        StartCoroutine(Wait(other));
    }
}

IEnumerator Wait(Collider other)
{
    yield return new WaitForSeconds(3);
    other.gameObject.SetActive (false);
}

A void cannot be delayed. The StartCoroutine(Wait()) line just starts the coroutine, it doesn’t wait for it to finish. You need to move the SetActive(false) into the IEnumerator after the delay.

GameObject triggerObj; //This just stores the trigger object so it can be accessed in the IEnumerator

    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Fall"))
        {
            triggerObj = other.gameObject;
            StartCoroutine(Wait());
        }
    }
    IEnumerator Wait()
    {
            yield return new WaitForSeconds(30000000);
            triggerObj.gameObject.SetActive(false);
    }