Disabling entity by name does not work

This is my code so far
Every time its triggered it disables the entire scene, am I missing something? I just want to disable the object with that name.

Hey, you are using the wrong syntax to disable entity. If you want to disable the “HOUSE” entity, here is how you can do it

var houseEntity = this.app.root.findByName("HOUSE");
houseEntity.enabled  = false;

I tried that but it says “HouseEntity is not defined” and the variable is declared but never read

“var” only has a limited scope and in this case, it’s within the initialize function.
So in order to use the HouseEntity in different functions, either make it a variable of the script or declare it within the onTriggerEnter function.

I just figured that out myself. Now, is it possible to make this script affect other scenes. As in if this script is triggered in one scene it will disable an entity in another scene. Ive heard of global scripts but im not sure how that works.