My Object Won't Turn Visible Again

The problem is for me is that I have the correct code and I set it up right, but it won’t turn visible again. It can go invisible, but can’t go visible again.

using UnityEngine;
using System.Collections;

public class Ammo : MonoBehaviour
{

public float WaitTime;

public GameObject Ammo_Box;

private int Count_Ammo;

// Use this for initialization
void Start()
{

    StartCoroutine("MoreAmmo");

    Count_Ammo = 0;
    
}



// Update is called once per frame
public void OnTriggerEnter(Collider other)
{
    if (other.gameObject.CompareTag("Player"))
    {
        this.gameObject.SetActive(false);

        

    }

}

IEnumerator MoreAmmo()
{
    if (Ammo_Box)
    {

        
        yield return new WaitForSeconds(WaitTime);
       
        Ammo_Box.SetActive(false);
        
        yield return new WaitForSeconds(WaitTime);
       
        Ammo_Box.SetActive(true);
       

    }

}

}

I don’t know what it is going wrong. I am also trying to create a if statement so when it it triggered and goes invisible, I want the counter to start and after the time is up, then goes visible again.

Once you disable an object, all its components get disabled too. So, whenever you disable the object, the attached script is no longer running, which is why your code isn’t going through. Create another script on an empty game object and call it LevelManager or something of the such, and then have the gameobject that is being disabled start a function in the LevelManager that will run your code that will enable the object again when needed. If this helped please accept the answer!