Why dosent work my script after load scene

i have a script on cassete which you pick and it hides and open and door, but when i load scene 3 the same script dosent work why ?
i have to destroy the old entity or something?.

Also other scripts for example enabled to false with code the light on the scene 3 dosent work why ?
this scripts dosent exit on the scene 1.

According to my understanding you have taken reference by searching in root given:

this.cassette = this.app.root.findByName("cassette");

This will always give you the reference of first entity it finds. So when you go into scene 3, it again finds you first entity reference that you have set to false. That is why it’s not working.
Just do one thing. Change that line to

this.cassette = this.entity;

and this should work in your case

A bit unrelated, but that’s a nice scene setup you have there.

@saif it dosent work i put diferent names cassete 1 in scene 1 and cassete 2 in scene 3 and changed it names in the scripts and it dosent work.

Hey! I just checked there are two entities with name “Door Salida”. So same issue will be there script will always be taking first entity.

Also you are disabling the script and then setting door eular angles. I am afraid door eular angle logic won’t work as script would already be turned off.

@saif what can i do rename the door and dont disabled the script ?

@saif yes now its work maybe it was for doorsalida and i have a question why i can disabled with a script the lights and scene 1 yes ?

@saif nop i checked and it dosent work the cassete, i changed the names and nothing happen

You can simply take the reference by the following way instead of finding from the root

Casset.attributes.add('door2', {
    type: 'entity',

now just drag the entity of door into editor in the script and then you can access the door2 by this.door2.

I don’t get it kindly elaborate.