RbxCloud
Open Cloud API for Roblox experiences
About
RbxCloud is an open cloud API for Roblox experiences.
- Object oriented
- Aims to be as close to the Roblox API as possible for the following services:
- DataStoreService
- MessagingService
- Promise-based
- Support for nearly all open-cloud features
- Place publishing will come in a later update.
Installation
npm install rbxcloud
Example Usage
RbxCloud is an npm package, meaning you must use JavaScript. A few examples will be found below:
Publish a message using MessagingService:
const { OpenCloud, MessagingService } = require('rbxcloud');
OpenCloud.Configure({
MessagingService: 'API-KEY', // This is an API key for MessagingService
UniverseId: 0, // You can get the UniverseId from the Asset explorer
});
MessagingService.PublishAsync('MyTopic', 'Hello World!').then(() => {
console.log('Success!')
}).catch(err => {
console.log(err);
})
Read and set a DataStore entry:
const { OpenCloud, DataStoreService } = require('rbxcloud');
const { DataStoreSetOptions } = DataStoreService.Objects;
OpenCloud.Configure({
DataStoreService: 'API-KEY', // This is an API key for DataStoreService
UniverseId: 0, // You can get the UniverseId from the Asset explorer
});
const GoldStore = DataStoreService.GetDataStore('Gold');
GoldStore.GetAsync(125196014).then(([data, keyInfo]) => {
console.log(keyInfo.DataType === JSON); // true / false
console.log(keyInfo.CreatedTime); // UNIX Timestamp
console.log(keyInfo.UpdatedTime); // UNIX Timestamp
console.log(keyInfo.Version); // DataStore key version
console.log(`The player has ${data.amount} gold!`)
});
// SetAsync the player's gold
GoldStore.SetAsync(125196014, {
currency: 'Gold',
amount: 100,
}).then((result) => {
console.log('Data saved: ', result);
}).catch((err) => {
console.log('Error', err);
});
Links
Contributing
Create an issue on the GitHub if you’d like to suggest anything or report an issue. For bug reports, please ensure that your report isn’t a duplicate of another issue.
Disclaimer
This is relatively new, and lacks some features. If you require Ordered Data Store support (which isn’t implemented as of 1.1.2), or any other feature that isn’t currently implemented, I recommend using roblox.js created by @Daw588. Please also feel free to give me any ideas or criticism.. This is my first Roblox open-source resource as well.