Skip to content

Experience

rblxopencloud.Experience(id, api_key)

Represents an experience/game on Roblox. Allows interaction with data stores, messaging service, etc.

Parameters:

Name Type Description Default
id int

The experience/universe ID

required
api_key str

The API key created on the Creator Dashboard with access to the experience.

required

Attributes:

Name Type Description
id int

The experience/universe ID

owner Optional[Union[User, Group]]

The object of the experience owner. Only present from OAuth2.

get_data_store(name, scope='global')

Creates a rblxopencloud.DataStore with the provided name and scope. This function doesn't make an API call so there is no validation.

Parameters:

Name Type Description Default
name str

The data store name.

required
scope Optional[str]

The data store scope. Set it to none for scope/key syntax.

'global'

Returns:

Type Description
DataStore

The Data Store with the provided name and scope.

get_ordered_data_store(name, scope='global')

Creates a rblxopencloud.OrderedDataStore with the provided name and scope. This function doesn't make an API call so there is no validation.

Parameters:

Name Type Description Default
name str

The data store name.

required
scope Optional[str]

The data store scope. Set it to none for scope/key syntax.

'global'

Returns:

Type Description
OrderedDataStore

The Ordered Data Store with the provided name and scope.

list_data_stores(prefix='', limit=None, scope='global')

Interates rblxopencloud.DataStore for all of the Data Stores in the experience.

Example

This will print every data store in the experience.

for datastore in experience.list_data_stores():
    print(datastore)
If you'd like the datastores in a list, you can use the list method:
list(experience.list_data_stores())

Parameters:

Name Type Description Default
prefix Optional[str]

Only return Data Stores with names starting with this value.

''
limit Optional[int]

The maximum number of Data Stores to iterate.

None
scope Optional[Union[str, None]]

The scope for all data stores. Defaults to global, and can be None for key syntax like scope/key.

'global'

Returns:

Type Description
Iterable[DataStore]

An Iterable of every rblxopencloud.DataStore in the experience.

Raises:

Type Description
InvalidKey

The API key isn't valid, doesn't have access to list data stores, or is from an invalid IP address.

NotFound

The experience does not exist.

RateLimited

You've exceeded the rate limits.

ServiceUnavailable

The Roblox servers ran into an error, or are unavailable right now.

rblx_opencloudException

Roblox returned an unexpected error.

publish_message(topic, data)

Publishes a message to live game servers that can be recieved with MessagingService.

The universe-messaging-service:publish scope is required for OAuth2 authorization.

Parameters:

Name Type Description Default
topic str

The topic to send the message in

required
data str

The message to send. Open Cloud does not support sending dictionaries/tables with publishing messages. You'll have to json encode it before sending it, and decode it in Roblox.

required

Raises:

Type Description
InvalidKey

The API key isn't valid, doesn't have access to publish messages, or is from an invalid IP address.

NotFound

The experience does not exist.

RateLimited

You've exceeded the rate limits.

ServiceUnavailable

The Roblox servers ran into an error, or are unavailable right now.

rblx_opencloudException

Roblox returned an unexpected error.

Note

Messages sent by Open Cloud with only be recieved by live servers. Studio won't recieve thesse messages.

upload_place(place_id, file, publish=False)

Uploads the place file to Roblox, optionally choosing to publish it.

Example

Replace 0000000 with the target place's ID, and example.rbxl should be the path to the roblox place file.

with open("example.rbxl", "rb") as file:
    experience.upload_place(0000000, file, publish=False)

Parameters:

Name Type Description Default
place_id int

The place ID to upload the file to.

required
file BytesIO

The place file to upload, opened in bytes.

required
publish Optional[bool]

Wether to publish the new place file.

False

Returns:

Type Description
int

The place's new version ID.

Raises:

Type Description
InvalidKey

The API key isn't valid, doesn't have access to publish places, or is from an invalid IP address.

NotFound

The experience does not exist.

RateLimited

You've exceeded the rate limits.

ServiceUnavailable

The Roblox servers ran into an error, or are unavailable right now.

rblx_opencloudException

Roblox returned an unexpected error.