Script Data can mean a few things. A few out of the box systems utilize scriptData as a small field of customData attached to that system document, for instance, Players and Challenge Instances have scriptData fields for storing custom information. You can call back this scriptData whenever you like.


However, Messages, Requests and Responses all have scriptData too, but this scriptData is not persisted. If you set the scriptData on the Response, you can only access that scriptData on receiving that response.

Similarly, if you set scriptData on a Request, that scriptData is only accessible from Cloud Code in the Response by using Spark.getData().scriptData.yourDataKey. It will not persist further than it's availability in Cloud Code, so in order to return the scriptData from the request through to the response received by the client you must again use Spark.setScriptData("requestScriptData", Spark.getData().scriptData.yourDataKey)