The best practice is to put custom Javascript inside of an A-Frame component, similar to the sample project. Also, comparing the sample project code with your code, I don’t see you calling window.inworldClient.connect() anywhere. I suggest taking another look at inworld.js from the sample project and doing something more similar to that in your project.