Quickstart
Create ServerScriptService/RoControlBootstrap.server.luau:
local ServerStorage = game:GetService("ServerStorage")
local RoControl = require(ServerStorage:WaitForChild("RoControl"))
local client = RoControl.init({
apiKey = ServerStorage.RoControlConfig.ApiKey.Value,
-- baseUrl defaults to https://api.rocontrol.app
logLevel = "info", -- use "silent" in production if you prefer
})
-- Surface failures without ever stalling gameplay.
client:onFailedOperation(function(failed)
warn(("[RoControl] %s failed (%s): %s"):format(
failed.operation,
failed.error.kind,
failed.error.message
))
end)
-- 1) Declarative: register a recurring schedule once at server start.
client:registerSchedule({
key = "world-events",
timezone = "UTC",
cycleSeconds = 1800, -- one event every 30 minutes
eventDurationSeconds = 300, -- each shows for 5 minutes
rotation = { kind = "sequential" },
events = {
{ key = "Lava", iconAssetId = "rbxassetid://111", durationSeconds = 300 },
{ key = "Toxic", iconAssetId = "rbxassetid://222", durationSeconds = 300 },
{ key = "Mirror", iconAssetId = "rbxassetid://333", durationSeconds = 300 },
},
})
-- 2) Imperative: report an ad-hoc event (admin/player/random triggered).
client:reportEvent({
key = "BlackHole",
iconAssetId = "rbxassetid://789",
durationSeconds = 120,
})
-- Flush pending work on shutdown.
game:BindToClose(function()
client:flush()
end)Which mode do I use?
| Mode | Use when | Traffic |
|---|---|---|
registerSchedule | Events follow a fixed cadence (e.g. every 30 min) | One registration per server boot |
reportEvent | Events are admin/player/random triggered | ~one report per occurrence (cross-server lease) |
Most games only need registerSchedule. Use reportEvent for the
unpredictable ones. See
Icon Automation Events.
Verify the connection
Open your game’s RoControl dashboard (Icon Automation → SDK). You should see the
schedule registration with the reporting placeId/placeVersion. Locally, set
logLevel = "debug" to see request logs — secrets are always redacted.
The SDK also exposes a health endpoint check via the dashboard; under the hood it
calls GET /api/sdk/v1/health, which verifies the key, derives the universe, and
confirms protocol connectivity.
Next: API Reference.