Attack timer

So i have an attack timer working similar to an hp bar
when an attack is called it counts down from a IEnumerator that calls a waitforseconds and the seconds are equal to the attackspeed

as far as i understand a Coroutine in this case counts down from the current value to 0

i need the fill of my bar to display the value of attackspeed as it is being counted down if possible

the update function looks like this at the moment im not sure whats missing

    void updateattacktimer()
    {
        float fillamount = attackspeed/100;
        if (fillamount != attacktimer.fillAmount)
        {
            attacktimer.fillAmount = Mathf.Lerp(attacktimer.fillAmount, attackspeed, Time.deltaTime * lerpspeed);
        }

    }

I’m not sure what you are doing, but if you are calling updateattacktimer repeatedly, you’re never going to go anywhere since your fillamount is always reset to attackspeed/100. (unless attackspeed is changing somewhere else).

Note that lerp doesn’t just run on it’s own. You need to continue to call it while the third parameter should be a value from 0-1. In this case, your third parameter is always time.deltaTime * lerpspeed, which means you’ll get a value that is pretty much the same. It isn’t going to move between the two values you pass it.

This is also not a coroutine that you are showing, so you may need to show a bit more code or explain a little more of what should be happening.