,I'm trying to stun enemies for 1 second when the bullet hit them. Got the enemy component and set their speed at 0 but coroutine isnt working. Why?

,IEnumerator Stun()
Enemy enemy = target.GetComponent();

    enemy.speed = 0;
    yield return new WaitForSeconds(1);
    enemy.speed += enemy.currentSpeed;

If your Coroutine is not even starting: Have you looked if you called it correctly? I always call Coroutines just like normal functions in the first try (as in “DoThis();”), but Coroutines work differently: “StartCoroutine(DoThis());” would be correct.

Have a look here: Starting Coroutines

If it’s not this, there might be an error in your Enemy enemy = target.GetComponent(); line. I think it is not getting anything? What component should it look for?