question

Kenny Roy avatar image
Kenny Roy asked

GetObjects with CloudScript

I cannot get GetObjects() to work with CloudScript. Admitedly, all of the Javascript I know, I know from googling to get CloudScript to work. Please let me know how I'm supposed to get these results and use them.

Before anyone suggests that I do this in client, I cannot, this is the primary point of cheating and has to be handled by CS.

var playersObjects = entity.GetObjects({Entity: titlePlayerAccount});     

var planets = playersObjects["planets"].DataObject; 

var count = Object.entries(planets);

my object looks like this:

["planetA","planetB"]

and the error I get is:

"Error": "JavascriptException",
            "Message": "JavascriptException",
            "StackTrace": "TypeError: Cannot read property 'DataObject' of undefined\n    at handlers.removeAllMemberships (A2460-main.js:126:45)\n    at Object.invokeFunction (Script:116:33)"
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Kenny Roy avatar image
Kenny Roy answered

I see now I'm missing playersObjects.Objects

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.