How would I get a variable’s value from another script and transfer its value to a new script?
Hi @Fus_ion,
You can do this by:
- Getting a reference to the entity this script instance is attached to
- Referencing the script component and the script instance like this:
var value = this.app.root.findByName('myEntity').script.myScriptName.myPropertyName;
This way you can get the value from one script property, and in the same manner set it to another.
Same way, as any regular JS property:
this.app.root.findByName('myEntity').script.myScriptName.myPropertyName = 'aNewName';
you could also use global variables but that’s not recommended