The scene doesn't restart

let button = this.add.sprite(5, 5, 'buttonRestart').setInteractive()

button.on('pointerup', function() {
            
    this.scene.restart()
})

What is the problem in my code?

Hi @buqer_ok,
You need to pass the scene context to the listener handler function, or use an arrow function:

button.on('pointerup', () => {            
    this.scene.restart();
});

It’s the value of this in the callback function. You can use your debugger to verify (or console.log statements, however you’ll need to preserve logs) but this in your callback refers to the button sprite. If you want to get the scene from the button, you’ll need to write this.scene.scene.

Alternatively, as you’re already using ES2015 features like the let keyword, you can use an arrow function for your button:

button.on('pointerup', () => {
  this.scene.restart();
});

You can read more about how arrow functions work with this here: