Entity children spawned via GetWorld():Spawn cannot properly SendToServer from the client

Describe the bug:

If you spawn a template that contains a child, and then try to use SendToServer from a script on that child, it will throw an error Cannot SendToServer to a script owned by another client

How do you cause this bug?

I’ve created a reproduction here: Crayta

The child in this case is a trigger. You could also use a voxel mesh, or an entity, etc. When I made the repro, I originally thought it was specific to triggers, but it’s actually any child.

  • Interacting with the alien tube in front of you will attempt to spawn a copy of itself to the right.
  • Interact with the alien tube once, and you will see a new alien tube to the right
  • Interact with this new alien tube, and an error will be thrown in the console.

Things to note:

  • Both the working entity and the broken entity are instances of the same template - it’s the same code.
  • If you remove the trigger, and place the bugScript on the entity instead, there is no error. It’s specific to the trigger.
  • If you move the bugScript to a child mesh, or a child voxel mesh, the error will still occur.
  • Clone also fails in the same way that spawning the template does

Screenshots / video of bug:

Your Crayta username: Cereal

Game seen in (including “Hub” or “Editor for XYZ”): Linked above

Time + date seen: March 05 2022

Version number (found in Help tab in Settings): 0.e5.40.115857

I updated this post today with additional information.

The original report and reproduction stated that this only happened on triggers within a template. This is not the case.

The bug can occur on any child inside the template. I’ve updated the repro to include a voxel mesh child that you can also interact with, showcasing this.

Here is an additional video showcasing it is happening with a voxel mesh as well as a trigger: