trying to rotate a 2D sprite, wait 3 seconds, rotate it back

I currently have this code:
{
public Transform character;

public float attackSpeed;

void Start()
{
    character = this.GetComponent<Transform>();
}


void Update()
{
    if (Input.GetAxis("Fire1") > 0)
    {
        character.Rotate(0, 0, 45, Space.Self);
        StartCoroutine(Wait());
        character.Rotate(0, 0, -45, Space.Self);
        StartCoroutine(Wait());
    }
}
IEnumerator Wait()
{
    yield return new WaitForSeconds(attackSpeed);
}

and can’t seem to find anything wrong but my object won’t rotate

Any ideas? thx in advance

This is relatively older, but the issue is that the coroutine is run independently of the update method. When you call the waiting coroutine, the update method keeps on running through all the code and essentially spawns in two instances of the coroutine every frame. The issue then is that you rotate the sprite 45 degrees and then -45 degrees, which means that the rotation negates itself every frame and nothing happens. To use the coroutines correctly you would have to rotate the sprite inside the coroutine rather than in update