How to temporarily set a game object active? [duplicate]

I’m trying to an use IEnumerator method called Wait() to temporarily enable and then wait, and disable a gameobject within a method. Basically I’m trying to create a muzzle flash within a shoot method, but whenever I add the muzzle.SetActive(false) to the method, it never activates in the first place. This code should work right?

void Shoot() {     muzzle.SetActive(true);     RaycastHit hit;     if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range))     {         Debug.Log(hit.transform.name);          Target target = hit.transform.GetComponent<Target>();         if (target != null)         {             target.TakeDamage(damage);         }     }     Wait((float).1);     muzzle.SetActive(false); }