How to get OnTriggerStay2D to work

I am trying to make a flamethrower weapon for my player character. I am using a system were I can change between weapons, and every other weapon works perfectly. The flamethrower is able to turn on its particle system(visual representation of the function of the flamethrower, but not relevant to my issue), but the OnTriggerStay2D function that I am using to detect if my capsule collider 2d on the flamethrower is hitting an enemy is not working. From other answers to similar questions, I have seen that it is commonly due to there not being a Collider and/or Rigidbody, and I have both on the flamer (CapsuleCollider2D, with" is trigger" set to true, in the shape of the area the flames occupy). another common issue that i have heard of is incorrect layers and z-positions, and I have tried both.

Here is my code for the ontriggerstay2d function:

void OnTriggerStay2D(Collider2D other)
    Debug.Log("Flamer collision");
    if (isFlamer && canshoot && flamerOn && other.gameObject.CompareTag("enemy"))
        Debug.Log("flamer firing");
        if (timeBtwShots == 0)
            Debug.Log("flamer damage applying");
            health = other.GetComponent<EnemyHealth>().health;
            Debug.Log( + " health: " + health);
            health -= damage;

            timeBtwShots = startTimeBtwShots;
            Instantiate(ash, other.transform);
            timeBtwShots -= Time.deltaTime;


I am not receiving any error messages or Debug.Logs in the console, and this leads me to believe that the ontriggerstay2d is not being called, or never detects any collisions.

The rest of the code works, and is just to turn the particle system representing the flames(which is not relevant to the physics) on and off, aim the flamethrower, and turn the flamethrower on and off.

The enemies which the flamer is meant to collide with and damage are on the same layer, sorting layer and z-position as the flamer.