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:

  1. A few seconds after start-up, the server registers: it sends its Cmdr command catalogue and what it supports.
  2. 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.
  3. It runs each command it receives and reports the result once.
  4. 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.

  1. Step 1: Add the module

    On Bloxlytics → your project → SDK, download CmdrBridge.luau. In Studio, insert a ModuleScript named CmdrBridge inside the Analytics ModuleScript (or next to it in ServerScriptService) and paste the file's contents.

  2. Step 2: Store the bridge key

    Add an experience secret named bloxlytics_bridge_key with the Bridge key from the SDK page's Keys, restricted to api.bloxlytics.app, as for the write key. A string key must start with bxb_; the write key won't work here.

  3. Step 3: Pass Cmdr to Start

    Add Cmdr and BridgeKey to your existing Start call. Analytics:Start finds the CmdrBridge module and starts it for you.

    ServerScriptService/BloxlyticsBoot.server.luau
    local 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,
    })
  4. 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.luau
    local 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.

  5. 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 AllowedGroups are 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.

local HttpService = game:GetService("HttpService")
local Cmdr = require(game.ServerScriptService.Cmdr)
local Analytics = require(game.ServerScriptService.Analytics)
local CmdrBridge = require(game.ServerScriptService.Analytics.CmdrBridge)

CmdrBridge:Init({
	Cmdr = Cmdr,
	Analytics = Analytics,
	BridgeKey = HttpService:GetSecret("bloxlytics_bridge_key"),
	ApiUrl = "https://api.bloxlytics.app",
	AllowedGroups = { "Admin" },
})

#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:

[Bloxlytics] Studio session. Target this server from the website with server "studio-1a2b3c4d".
[Bloxlytics bridge] Listening for commands as Studio server "studio-1a2b3c4d". Pick it in Bloxlytics to target this session.

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 Cmdr from Start, or remove the CmdrBridge module.
  • 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.

#Where next