Charge Flash Effect Bug

I’m not sure if I could explain it properly, so I made a video showing my issue,

As you can see in the video, sometimes the flash effect doesn’t reset properly. I wonder how I would make sure it reset every time? I set it to a float, so it plays the animation whenever the float gets above a certain number, but it doesn’t seem to reset properly, sometimes(but not always) it even flashes after an attack when I’m not even holding the button down. Here’s my attack script, I think everything should be in here…

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AttackBoy : MonoBehaviour
{
    public Animator animator;
    public Animator lightAnimator;
    public float attackTime;
    public Player player;
    public int dmg;
    public bool attackRoutine;
    public bool charging = false;
    private float chargeTime = 0;
    public AudioSource[] ltAttackSnd;
    public AudioSource[] hvAttackSnd;
    public int randomSound;

    public void Start()
    {
        player = FindObjectOfType<Player>();
    }
    public void Update()
    {
        lightAnimator.SetFloat("Charging", chargeTime);
        if (Input.GetKeyDown(KeyCode.Space) && !player.isDead && !attackRoutine)
        {

            LightAttack();
            charging = true;
        }
        if (Input.GetKeyUp(KeyCode.Space))
        {

            if (!attackRoutine && chargeTime > 2f)
            {
                HeavyAttack();
                chargeTime = 0;
            }
            else if (!attackRoutine && chargeTime > 0.25f)
            {
                LightAttack();
                chargeTime = 0;
            }
            charging = false;
        }
        if (charging)
        {
            chargeTime += Time.deltaTime;
            StartCoroutine(ChargeTime());
        }
    }
       IEnumerator ChargeTime()
    {
        yield return new WaitForSeconds(0.5f);
        if (charging)
        {
            animator.SetBool("isHvAttacking", true);
            animator.speed = 0;
        }
    }
    void LightAttack()
    {
        randomSound = Random.Range(0, ltAttackSnd.Length);
        dmg = 1;
        player.walkSpeed = 5;
        animator.SetBool("isLtAttacking", true);
        attackTime = 0.25f;
        ltAttackSnd[randomSound].Play();
        StartCoroutine(Attacking());
    }

    void HeavyAttack()
    {
        randomSound = Random.Range(0, hvAttackSnd.Length);
        player.stopMove = true;
        dmg = 3;
        animator.SetBool("isHvAttacking", true);
        attackTime = 1.5f;
        hvAttackSnd[randomSound].Play();
        StartCoroutine(Attacking());
    }

    IEnumerator Attacking()
    {
        Collider2D[] enemiesToKill = Physics2D.OverlapCircleAll(player.attackPos.position, player.attackRng, player.enemies);
        attackRoutine = true;
        for (int i = 0; i < enemiesToKill.Length; i++)
        {
            enemiesToKill[i].GetComponent<EnemyCreator>().splatty = false;
            enemiesToKill[i].GetComponent<EnemyCreator>().ReceiveDamage(dmg);
        }
        yield return new WaitForSeconds(attackTime);
        animator.SetBool("isLtAttacking", false);
        animator.SetBool("isHvAttacking", false);
        attackRoutine = false;
        player.walkSpeed = player.speedSet;
        player.stopMove = false;
    }

}

Also, another issue, and it’s likely unrelated, is the basic attack animation just sometimes doesn’t play. Sorry for asking two questions in one thread, but would someone please be able to help me fix these issues?

Thanks in advance.

Edit: Just a quick note, the light is a separate object, and has it’s own animator. The lightAnimator is referencing the light’s animator.

Bump