[SOLVED] Adding a script programmatically

Let’s say I want to spawn an object and then add it to the scene with a ‘bullet.js’ script onto it. How would I go about doing so?

I only get as far as ‘addComponent’ but not sure what to do next.

Nevermind info here >> https://developer.playcanvas.com/en/user-manual/scripting/legacy/script-attributes/