Accessing another script doesnt work

Hello guys i have a little problem, when i try to access the script from other script, it somehow doestn work and i cant find whats wrong. here’s what console says

and here is the code

1 Like

Try using the following line and it should work

var gameMovementRef = entity.other.script.playerMovement;
gameMovementRef.setState('dance.glb');

Uncaught TypeError: Cannot read property ‘script’ of undefined

Still the same :confused:

I’m not sure if you need the ‘other’ in there for triggers. Does it still say that if you do “entity.script.playerMovement.setState(‘dance.glb’);”?

It’s saying that entity.other is not defined

1 Like

That was the issue, now it is working, thanks:)

No problem! :smile: