basically Tried to make own attack function and not getting health returning where function called from.

below you can see my code i have wrote .

public static float doAttack(float attackPower, float healthPool)
    {
        Debug.Log("this is working but not not taking health off????");
        healthPool -= attackPower * Time.deltaTime;
        //health -= 500 * Time.deltaTime;
        return (healthPool);
    }

and here is where i call it from.

 void OnTriggerEnter2D(Collider2D other)
    {
        attack.doAttack(attackForce, health);
        

    }

as you can I pass in my variable but dont seem to get the return since the health doesnt decrease can anyone put out where i am going wrong.

Answered my self lol ended up I sorted and will post code below so anyone with similar can see where i was going wrong .

void OnTriggerEnter2D(Collider2D other)
    {
        health = attack.doAttack(attackForce, health);
       

    }

so yet was making the call but wasnt telling my code why it was making the call and what variable was going to be effected.