Cmdr bridge
Cmdr bridge
Let permitted team members run your game's registered Cmdr commands, macros, kicks and warnings from Bloxlytics, and install the CmdrBridge module.
The Cmdr bridge connects your live game servers to Bloxlytics so that team members with permission can run your game's Cmdr commands from the dashboard: one at a time on Commands, as saved sequences with Macros, and as kicks and warnings from Moderation and Player lookup.
It is a separate, optional ModuleScript, CmdrBridge, with its own key (the Bridge key, bxb_…). You can use analytics without the bridge, and the bridge without sending analytics.
#What it can run
The bridge runs exactly four kinds of command, and nothing else:
| Kind | What runs | Enabled by |
|---|---|---|
cmdr |
A command line for one of your registered Cmdr commands, parsed, validated and run by Cmdr's own dispatcher with your BeforeRun hooks. | Cmdr |
kick |
Player:Kick(message) on a player in this server. |
On unless AllowKick = false |
warn |
Your OnWarn(player, message) function. |
OnWarn |
announce |
Your OnAnnounce(message) function. |
OnAnnounce |
No code from the website
The bridge never evaluates source code. It can only run commands that your game has registered with Cmdr, only through Cmdr, and only after Cmdr has checked their arguments and your BeforeRun hooks have allowed them. If a command isn't registered in your game, nobody can run it from Bloxlytics. See security.
#How it connects
Roblox game servers can't accept incoming connections, so the bridge connects out to Bloxlytics over HTTPS:
- A few seconds after start-up, the server registers: it sends its Cmdr command catalogue and what it supports.
- It long-polls: each request waits up to 20 seconds for commands addressed to this server (or to any server), and reports the players in it.
- It runs each command it receives and reports the result once.
- When the server shuts down it says goodbye, and Bloxlytics removes it from the live list.
Commands expire 60 seconds after they are sent, so a command never runs long after you asked for it. The full lifecycle is on the bridge reference, and the wire protocol on hello, poll, result and bye.
#Install
You need Cmdr already set up on the server, with your commands registered, and the analytics module installed.
Step 1: Add the module
On Bloxlytics → your project → SDK, download CmdrBridge.luau. In Studio, insert a ModuleScript named
CmdrBridgeinside theAnalyticsModuleScript (or next to it in ServerScriptService) and paste the file's contents.Step 2: Store the bridge key
Add an experience secret named
bloxlytics_bridge_keywith the Bridge key from the SDK page's Keys, restricted toapi.bloxlytics.app, as for the write key. A string key must start withbxb_; the write key won't work here.Step 3: Pass Cmdr to Start
Add
CmdrandBridgeKeyto your existingStartcall.Analytics:Startfinds theCmdrBridgemodule and starts it for you.ServerScriptService/BloxlyticsBoot.server.luaulocal HttpService = game:GetService("HttpService") local Cmdr = require(game.ServerScriptService.Cmdr) -- your server Cmdr module local Analytics = require(game.ServerScriptService.Analytics) Cmdr:RegisterDefaultCommands() Cmdr:RegisterCommandsIn(game.ServerScriptService.CmdrCommands) Analytics:Start({ WriteKey = HttpService:GetSecret("bloxlytics_write_key"), ApiUrl = "https://api.bloxlytics.app", Cmdr = Cmdr, BridgeKey = HttpService:GetSecret("bloxlytics_bridge_key"), AllowedGroups = { "Admin", "DefaultAdmin" }, -- Cmdr groups Bloxlytics may run -- AllowSystemCommands = false, -- only run as the sender's own player in the server OnWarn = function(player, message) -- show the warning with your own UI end, })Step 4: Allow platform commands in your BeforeRun hook
Commands sent by a team member who is in the server run as their player, so your existing BeforeRun hooks judge them exactly as if they had typed the command. Anything else runs in the system context, with no executor. Allow it in your hook, or refuse it everywhere with
AllowSystemCommands = false:ServerScriptService/CmdrHooks.server.luaulocal Cmdr = require(game.ServerScriptService.Cmdr) local CmdrBridge = require(game.ServerScriptService.Analytics.CmdrBridge) Cmdr.Registry:RegisterHook("BeforeRun", function(context) if CmdrBridge.IsPlatformContext(context) then return nil -- Bloxlytics already checked the sender's role and permissions end -- … your existing in-game permission checks … return nil end)Cmdr itself refuses commands in live games when no BeforeRun hook is registered, and the bridge runs Cmdr's hooks, so without a hook nothing runs from Bloxlytics either. See who a command runs as.
Step 5: Publish and check
Publish and join a live server. Open Commands in Bloxlytics: your registered commands appear and the server appears in the server picker. Commands outside
AllowedGroupsare listed but refused before they are sent. Run a harmless command, such as one that replies with text, to check the round trip.
Team members with the Execute Cmdr commands permission can now run your commands from Bloxlytics. Every command, its sender, its server and its result are recorded in the command history and the audit log.
#Register commands first
The bridge waits 3 seconds after start-up before sending its catalogue, so commands registered in the same frame as Start, or just after, are included. Commands registered later show up when the bridge re-registers, every 5 minutes. Bloxlytics lists commands any server has reported in the last 24 hours.
#Starting the bridge on its own
If you start analytics with Init, or don't use the analytics module, start the bridge yourself with CmdrBridge:Init. Pass Analytics so both modules use the same server id and heartbeats report the bridge.
#Studio
The bridge runs in Studio by default, so you can try commands before publishing; analytics doesn't, unless you set TrackInStudio. Studio has no JobId, so each Studio session gets its own server key, printed in the output:
Pick that server in Bloxlytics to send it commands. Studio sessions are marked as Studio and are never chosen automatically: a command for "any server" goes to a live server, and if only Studio sessions are online, Bloxlytics asks you to choose one explicitly.
To keep the bridge off in Studio, set EnableBridgeInStudio = false in Start (or EnableInStudio = false in CmdrBridge:Init). Unpublished places need ProjectID, as for analytics.
#Turning it off
- For the whole project: turn off Cmdr bridge in the SDK page's Configuration. Bloxlytics refuses new commands at once. Servers that start while it is off don't poll at all. See remote configuration.
- For one game: remove
CmdrfromStart, or remove theCmdrBridgemodule. - Immediately, everywhere: rotate the Bridge key on the SDK page. Every running server loses the bridge until it is restarted with the new key.
#Troubleshooting
The output says the CmdrBridge module wasn't found
Analytics:Start looks for a ModuleScript named exactly CmdrBridge inside Analytics or in the same parent as Analytics. Move or rename it.
Registration failed
The bridge warns [Bloxlytics bridge] registration failed (<status>): <message> and tries again after 5 seconds, doubling the wait up to 2 minutes. 401 means the bridge key or project id is wrong. 0 means the request never left the server: check Allow HTTP Requests.
If the message is tags: Invalid input: expected record, received array, this server has no server tags: in SDK 1.0.0, Roblox encodes an empty tag table as an array, which the API refuses. Set at least one tag with Analytics:SetServerTag before Start, and make sure the bridge was started with the analytics module (through Start, or with Analytics passed to CmdrBridge:Init), since that is where its tags come from.
Commands are listed but every run is rejected
Read the error on the execution. Rejected by BeforeRun hook: … comes from your hook; allow platform contexts with IsPlatformContext. The <group> group isn't allowed from Bloxlytics (AllowedGroups). means the command's Cmdr group isn't in AllowedGroups. This game only runs Bloxlytics commands as a team member who is in the server means AllowSystemCommands = false and you aren't in that server.
No server shows up in the picker
The server must have registered and be polling. With Debug = true the bridge prints [Bloxlytics bridge] registered <n> commands on success, and (bridge disabled in project settings) if the project's Cmdr bridge switch was off when it started; that server won't poll until it restarts.