Can't access other entities userdata from entity server script?



for some reason I can’t seem to access userData using getEntityProperties for other entities except parent entity in a Entity Server Script. Also when I run getChildrenIDs on the parent of the entity that’s running the entity script it only returns the ID of my entity, not the other Children which I know exist (and which I can return in a Client Entity Script running on that same entity).

Is this a bug or a permissions issue? How can I raise the permission on those other entities so I can access their UserData?

Alternatively, what’s the best way of accessing the state of many entities which users can change the state of if you can’t use UserData as it’s not accessible? Should I create my own pseudo-database in one of the parent entities, or use messaging system to update changes of state?



Entity Server script usually is limited to the entity that have working entity server scripts, or anything created by it can be accessible by it.

So from what I understand, it behaves like a sandbox separate from the Entity server, but mixed together in the Entity Server, and using the same Messaging Layer.

But yeah, state can be handled by the Entity Server Script or Assignment Client. You should never rely on the state on the Entity scripts, as they are running on multiple devices at the same time.


That’s rather… odd. Like, I can maybe understand not being allowed to access other entities (to a degree), but a lack of access to entities linked to the entity itself? That feels a bit odd.

For example, I am working on a skee-ball game (which is more or less a boot camp through physics in HF if anything) and there are different zone holes that will be parented to the main unit. The holes I’d like to have communicate with each-other, or at the very least, communicate their existence to the main unit, which I could totally do with getChildrenIDs. I’d like to avoid using client scripts to avoid cheating, but this limit sounds pretty harsh and generating the zones to talk with the main unit is a bit overkill for what should be pretty simple.

So I guess I’m in the same boat before I got the scripting done: how would I allow the parent entity to see its own children on the entity script server level? Heck, I’d be fine if it was a domain setting that had to be raised with a UUID listing.


@Menithal what’s the best way of handling data across an application then? ie where do you put the model? I can see several ways of doing this:

  1. Setup an entity server script as a model which holds all app data and communicate with it via the messaging system. Issue with this is maintaining state between server restarts, though you could use userData as a persistent storage if that’s important.
  2. Storing state in UserData in relevant entity (I’ve been running into two problems with this, first I can’t access it from some Entity server scripts and second there seem to be lagging/buffering issues meaning my view isn’t always matching the userData)
  3. Calling methods in other entities via callEntityMethod (two issues with this, first is scope as some server scripts can’t access all entities plus issues if it’s in the client entity script figuring out which instance to call, second I can’t seem to get callEntityMethod to call back, is that possible or do we have to revert to the messaging system?)
  4. Setup an actual database on another server and communicate via http (maybe this will be the ultimate solution, or such a database will be built into high fidelity, but seems like a lot of work currently and presumably overkill for most things currently being built)
  5. Read and write to a JSON file.


You have to remember if an entity is a “child of another entity”, it just a reference not an actual hiearchy.

edit js (create app) and the physics force it to behave as single unit instead and the client connect the entities together, but ive understood thay the entity server still considers them as separate entities that linked via Id not actually via hiearchy. Atleast from what I understand underneath the create app.

Edit: NVM. Looked it up again. Was incorrect on the create app part. edit properties applies to child on client.

I haven’t tested it, but I am pretty sure this can be verified with a linked list of parented entities and seeing how fast the entity server reacts to moving few hundred thousand entities by moving the parent.

Instead the way would be for the entity server script to build the logic similarly to how to short bow does it and manage the state. iIRC entity server scripts can only see other entities it created or other entities with entity server scripts

This still forces The logic to the server script, while any collisions and physics would be communicated by the client (as far as I’ve tested, dynamic/kinematic still are only a client sided thing).

So yes
@DustyWizard, the first item on the list maybe the best course of action; JSON in the userdata on the controlling server entity script can handle and contain states.

You can also combine this with point 4 and 5.


@Menithal The first method does not appear to work. I can’t seem to be able to write to the userdata from a Server Entity script, even to the user data of that same script:

This is what I’m using:
var writeResult = Entities.editEntity(entityID, {
userData: JSON.stringify(userData)

The funny thing is that writeResult shows it was a success, but the data isn’t there. This is strange behavior to me.


Ok, that is definitely unexpected.

I haven’t gotten around to actually using it (userdata thats is from EntityServer Script, only properties of the entity like colors). Did you check if it would accept just any string?

Ill try it later when I get home.


No need. I didn’t formulate the forumla right, user data wasn’t in “”.

Just tested it, it works fine.