cannot be an iterator block because `void' is not an iterator interface type

Assets/silahsistem.cs(56,6): error CS1624: The body of silahsistem.efekt()' cannot be an iterator block because void’ is not an iterator interface type

Assets/silahsistem.cs(62,6): error CS1624: The body of silahsistem.mermisayisi()' cannot be an iterator block because void’ is not an iterator interface type

i tried make my scripts js to c# i dont know why gave error like this.

void efekt (){
muzzleflash.transform.Rotate(Vector3(90,0,0));
yield return new WaitForSeconds(0.1f);
muzzleflash.gameObject.SetActive(false);
}

void mermisayisi (){
mermi-=1;
if(mermi < 1 && kalanmermi > 0){
GetComponent().Play(“sarjordegis”);
yield return new WaitForSeconds(1);
mermi+=7;
kalanmermi-=7;
}
}

Void functions cannot return values. To use WaitForSeconds(), you need to call it in and IEnumerator or IEnumerable function.

So you would use something like this:

IEnumerator efekt ()
{ 
muzzleflash.transform.Rotate(Vector3(90,0,0));
yield return new WaitForSeconds(0.1f); 
muzzleflash.gameObject.SetActive(false); 
}

Note that you need to call efekt() in another function, or set the IEnumerator as your Update(), FixedUpdate(), or LateUpdate() function. So, using the following code will call your IEumerator once every frame. This wil cause your muzzleflash to spin rapidly and turn off.

void Update()
{
StartCoroutine(efekt());
}

Alternately, for the same effect, you could do this:

float Timer = 0f;

        void Update()
        {
            Timer += Time.deltaTime;

            if(Timer >= 1f)
            {
                muzzleflash.transform.Rotate(Vector3(90, 0, 0));
                yield return new WaitForSeconds(0.1f);
                muzzleflash.gameObject.SetActive(false);
                Timer = 0f;
            }
        }

This will do the exact same thing, once a second, without using coroutines. Also, I should note that in the code you provide, you won’t turn the muzzleflash, you’ll add 90 to it’s rotation along the x axis.