Copying Scripts without being instances?

I´m currently working on a game that includes objects moving on an conveyoer belt. I created some kind of path system where objects move from one element to the next. I want to spawn different objects via code that move on that. But it seems if a new object is created, they´re all clustered in one point. So my question is how can I clone a script without being an instance of the source script. Or do I have to work with arrays within that one script?

thanks

This sounds like a bug in the way you clone and position entities. Is it possible to share a link to your project? You can PM me the link if it’s private.

Have you seen this tutorial about creating entities programmatically?

http://developer.playcanvas.com/en/tutorials/advanced/programmatically-creating/

Hard to know the problem without seeing the script. But maybe you’re not adding the entity to a hierarchy?

Yes, I used this tutorial to creat the spawn function. My code is similiar except i use this part to attach the script. entity.addComponent(“script”); entity.script.create(“moving” {attributes: {speed: 1 }});