Event listeners keep executing code even on scene change

I have event listeners on certain scenes, and when I change to another one, they keep working and generating errors because in the other scene there aren’t some objects for it to work.
As far as I know, when the scene changes, the event listeners are supposed to stop, but in my game they don’t…

If you create your own events, then it’s up to you to clear them all in the Scene shutdown. They are not removed automatically (as there is no notion of which ones have been created)

Hi, thanks for your response, I’ve been trying to do this but I’m just getting errors with the off and removeListener functions, what should I do to remove an event that was added this way?

eventTest.add("eventName", function)

@Mastertaco this is what we do, in the Scene constructor:

scene.sys.events.once(‘shutdown’, () => {
eventEmitter.off(“eventName”, functionName)
});