[SOLVED] Changing scenes results in error that shoudnt be there

I am making a menu for my game, and a few problems have appeared. When I launch from the main menu scene, i get no errors, until I click the button that takes me to the main scene. Here I get some errors regarding my shooting scipt, but when i launch from the main scene, I get no errors. Another error is that when my player dies, he is sent to the main menu, but the script that took him there is still running, so when you click the script tries to run but fails and outputs a bunch of errors. Could someone take a look at the project and try to help me?

https://playcanvas.com/project/1027777/overview/idk-at-this-point

// this is the code that takes the player to the main menu when
//he is dead, attatched to my first person movement script 
//which also has my shooting script
  
  if (this.health <= 0) {
        this.app.scenes.changeScene('menu');
    }

this.entity.button.on('click', function(event) {
                this.app.scenes.changeScene('First Person Movement');
    }, this); // this code changes the scene when the "play game" button is clicked on the main menu

help :frowning:

I got it working after some tinkering because of some DM’s. thanks!