MV How can I make it so that when hitting with a weakness, the actor gains MP?

Hello...
Do you know how I can make it so that when I hit an enemy with its weakness, the character who executed the attack receives an MP point?. I only know that it can be done using the YF Skill Core.
is this only supposed to apply to one specific skill? or is it supposed to be when a battler hits a weakness with any skill? if its the latter, you'd want to be using yanfly's buffs and states core instead of the skill core.
is this only supposed to apply to one specific skill? or is it supposed to be when a battler hits a weakness with any skill? if its the latter, you'd want to be using yanfly's buffs and states core instead of the skill core.
I just want it to be applied to a few skills.
put this in the noteboxes for the skills
Code:
<Post-Damage Eval>
if (this.calcElementRate(target) > 1)
  user.gainMp(1);
</Post-Damage Eval>

Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-make-it-so-that-when-hitting-with-a-weakness-the-actor-gains-mp.177402/