MV HELP with Skill that Deletes a random Buff

Hi everyone,

I'm trying to create a skill that removes a random buff from the target. So, if the target has 3 buffs, the skill selects one at random and removes it from the enemy, even if that buff has a stack; it's still removed, not just reduced. I've been using this code, but it doesn't seem to be working:
JavaScript:
<After Eval>
var chance = 0.25; // 25% de chance
if (Math.random() < chance) {
  var buffParams = [2, 3, 4, 5, 6]; // ATK, DEF, AGI
  var active = buffParams.filter(id => target.isBuffAffected(id));
 
  if (active.length > 0) {
    var paramId = active[Math.floor(Math.random() * active.length)];
    target.removeBuff(paramId); // remove um buff aleatório
  }
}
</After Eval>

Eu estou usando o plugin YEP Buffs and States core
1773617832274.png
I've been using this code, but it doesn't seem to be working
the code should be functional. are you certain sure that its not working? you did write it to only run 25% of the time. if you havent tested it multiple times on parameters other than hp, mp, or luck, you need to. if you have, i suggest adding console.log()s to make sure things are running when they should

Original thread: https://forums.rpgmakerweb.com/threads/help-with-skill-that-deletes-a-random-buff.182890/