Residue of the previous execution of the auxiliary scene

Hello again folks. Hope you are well!
I’m passing information to an auxiliary scene for choosing skills and after choosing the game the game goes on again.
After leveling up again I call the scene again and choose a new skill and one thing caught my attention.
The choice I made earlier is executed along with the new one and after making a third call the same function is called +2 in addition to the new one and so on. Has anyone ever experienced this? And do you know how to get around? A part of the code is here!
Main code:

let skills = this.listaDeSkills.getChildren()
            this.scene.launch('menuskill',[skills[op[1]], skills[op[0]]])
            //this.events.emit('descSkill1', this.listaDeSkills.razendepelo);
            //this.events.emit('descSkill2', this.listaDeSkills.morcego);
            this.scene.pause()
            this.mainScene = this.scene.get('menuskill');
            this.mainScene.events.on('recebeMenu', (skill) => {
                skills[skill.op].level++
                this.escolheSkill(skill.nomeSkill)
 
            });

Scene aux

init(dados){
       
       this.skill1 = dados[0]
       this.skill2 = dados[1]
       
       if(this.skill1.cdr == '-1s'){
           this.skill1.cdr = 'NA'
       }
       if(this.skill2.cdr == '-1s'){
           this.skill2.cdr = 'NA'
       }
this.menu1 = this.add.image(400 - 105,300,'tester').setInteractive()
        this.menu2 = this.add.image(400 + 105,300,'testeb').setInteractive()

        var estilo1 = { font: "15px Arial",  align: "left", color:"#FFFFFF", fontStyle: 'bold', fontFamily: 'sans-serif'};
        var estilo2 = { font: "15px Arial",  align: "left", color:"#FFFFFF", fontStyle: 'bold', fontFamily: 'sans-serif'};
   
        this.text1 = this.add.text(402 - 205, 360, `Nome da skill - ${this.skill1.nome}\nDescrição - ${this.skill1.desc}\nCDR - ${this.skill1.cdr}\n`, estilo1);
        
        this.text2 = this.add.text(402 + 5,360, `Nome da skill - ${this.skill2.nome}\nDescrição - ${this.skill2.desc}\nCDR - ${this.skill2.cdr}\n`, estilo2);
  
        

        this.menu1.on('pointerdown', function(){
            this.events.emit('recebeMenu',  {nomeSkill:this.skill1.nome, op:0});
            this.scene.resume('cena001')
            this.scene. ('menuskill')
        }, this)
        this.menu2.on('pointerdown', function(){
            this.events.emit('recebeMenu', {nomeSkill:this.skill2.nome, op:1});
            this.scene.resume('cena001')
            this.scene.stop('menuskill')
        }, this)

Thanks!!!

You need to remove scene event handlers.

const onRecebeMenu = (skill) => {
  skills[skill.op].level++;
  this.escolheSkill(skill.nomeSkill);
};

this.mainScene.events.on('recebeMenu', onRecebeMenu);

this.events.once('shutdown', () => {
  this.mainScene.events.off('recebeMenu', onRecebeMenu);
});

image
hello, I must be doing something wrong :(, but could you explain to me what the shutdown function is doing here? The same problem persisted.

let skills = this.listaDeSkills.getChildren()
            this.scene.launch('menuskill',[skills[op[1]], skills[op[0]]])
            //this.events.emit('descSkill1', this.listaDeSkills.razendepelo);
            //this.events.emit('descSkill2', this.listaDeSkills.morcego);
             
            this.scene.pause()
            const onRecebeMenu = (skill) => {
                skills[skill.op].level++;
                this.escolheSkill(skill.nomeSkill);
                console.log('passeiaqui')
              };
            this.mainScene = this.scene.get('menuskill');
            this.mainScene.events.on('recebeMenu', onRecebeMenu);
            this.events.once('shutdown', () => {
                this.mainScene.events.off('recebeMenu', onRecebeMenu);
              });
              

fix the repeatability like this(using once)!
Really thanks for the time’-’

this.mainScene.events.once('recebeMenu', onRecebeMenu);