API Reference
API Reference for Cobalt Plugins
Cobalt
This is the global table available in every plugin's environment. It provides access to all plugin APIs.
PluginData
This is the table that contains the information about the plugin. It is required to be set and should be the first thing that executes in the file.
| Prop | Type | Default |
|---|---|---|
Name | string | - |
Description | string | "No description provided." |
Author | string | "N/A" |
Version | string | "0.0.0" |
Game | string | number | table | "*" |
Example
If the current game does not match the Game field, the plugin thread is automatically cancelled and will not run.
Settings
A proxy table that reads and writes persistent settings to Cobalt/Settings.json. This includes both built-in Cobalt settings and plugin settings.
Example
Sonner
The toast notification system. Exposes success, error, and other methods.
Example
ExecutorSupport
A table containing the results of executor capability checks. Use this to gate features based on what the executor supports.
Example
BindToUnload
Binds a cleanup callback that runs when the plugin is unloaded (e.g. on rescan or Cobalt exit).
| Arg | Description | Type |
|---|---|---|
| 1 | The function to call on unload | () -> () |
Example
Always clean up Instances, connections, and state in your unload callback to prevent memory leaks.
GetLog
Gets the tracked log for a specific instance and direction.
| Arg | Description | Type |
|---|---|---|
| 1 | The remote instance | Instance |
| 2 | The direction | "Incoming" | "Outgoing" |
Example
Cobalt.Spy
Functions for intercepting, appending, and clearing remote call logs.
InterceptExecutedCalls
Hooks into the spy pipeline to intercept remote calls as they happen.
The callback receives (info, instance, callType) where:
infocontainsArguments,Origin,Function,Line,IsExecutor, etc.instanceis theRemoteEvent/RemoteFunction/ etc.callTypeis"Incoming"or"Outgoing"
Return values from the callback:
- Return nothing — allow the call through normally
- Return
false— suppress the log entry from appearing
Returns a cleanup function that removes the interceptor when called.
Example — Global interceptor
Example — Instance-specific interceptor
AppendLog
Injects a custom log entry for a remote instance. Commonly used with virtual BindableEvent instances to display decoded protocol traffic.
| Arg | Description | Type |
|---|---|---|
| 1 | The remote instance (can be a virtual BindableEvent) | Instance |
| 2 | The direction | "Incoming" | "Outgoing" |
| 3 | The call data table | table |
| Prop | Type | Default |
|---|---|---|
Arguments | table | - |
Origin | string? | - |
Function | string? | - |
Line | number? | - |
IsExecutor | boolean? | - |
Example
ClearLogs
Clears tracked logs, optionally filtering by instance and/or direction.
| Arg | Description | Type |
|---|---|---|
| 1 | Optional instance to clear logs for | Instance? |
| 2 | Optional direction filter | "Incoming" | "Outgoing" | "All"? |
Example
Cobalt.CodeGen
Functions for intercepting and customizing code generation.
InterceptGeneration
Intercepts Cobalt's code generation pipeline. If the callback returns a string, it replaces the default generated code. If it returns nil, the default code is used.
| Arg | Description | Type |
|---|---|---|
| 1 | The type of code generation to intercept | "Call" | "Hook" | "InstancePath" |
| 2 | The interceptor callback | function |
Returns a cleanup function.
Example — Custom call code
Example — Custom instance path for virtual instances
Serialize
Serializes a value to Luau code.
Example
Indent
Indents a code string by a given number of levels (4 spaces per level).
Example
Cobalt.UI
Functions for creating UI elements, modals, and extending Cobalt's interface.
New
Creates a new Roblox GUI instance with sensible defaults applied (e.g. transparent backgrounds on labels, default font, BorderSizePixel = 0). Supports nested instance creation by passing tables as property values — the table key becomes the child's ClassName and the table value becomes its properties.
| Arg | Description | Type |
|---|---|---|
| 1 | The Roblox class name to create | string |
| 2 | Properties to apply. Table values create child instances, numeric keys clone Instance values as children. | table |
Example
Default properties are applied per class (e.g. TextLabel gets white text, the default font, RichText = true, and transparent background). You can override any default by specifying it in the properties table.
NewIcon
Creates an ImageLabel with a Lucide icon applied. Accepts the same properties table as New.
| Arg | Description | Type |
|---|---|---|
| 1 | The Lucide icon name (e.g. "search", "settings", "x") | string |
| 2 | Properties to apply to the ImageLabel | table |
Example
HideCorner
Creates an opaque Frame that visually hides a rounded corner of a parent frame. Useful for making tab-style interfaces where some corners should appear square.
| Arg | Description | Type |
|---|---|---|
| 1 | The parent frame whose corner to hide | GuiObject |
| 2 | The size of the hiding frame | UDim2 |
| 3 | The anchor/position offset (e.g. Vector2.new(0, 1) for bottom-left) | Vector2 |
CreatePluginSettings
Creates a settings section for your plugin, visible when clicking the plugin in the Plugins list. Returns a SectionBuilder that you can use to add UI elements. All settings created through this section are automatically persisted to disk.
The returned SectionBuilder has the following methods:
AddLabel
CreateButton
CreateCheckbox
| Prop | Type | Default |
|---|---|---|
Text | string | - |
Default | boolean | false |
Callback | (boolean) -> () | - |
CreateTextBox
| Prop | Type | Default |
|---|---|---|
Text | string | - |
Default | string | "" |
Placeholder | string | - |
ClearTextOnFocus | boolean | false |
Width | number | 160 |
NumericOnly | boolean | false |
Callback | (string) -> () | - |
CreateDropdown
| Prop | Type | Default |
|---|---|---|
Text | string | - |
Values | table | - |
Default | any | - |
Multi | boolean | false |
AllowNull | boolean | false |
Callback | (any) -> () | - |
CreateRow
Creates a horizontal sub-row for placing multiple elements side-by-side. Returns a new SectionBuilder.
Full Example
CreateModal
Creates a resizable, blank modal dialog.
| Arg | Description | Type |
|---|---|---|
| 1 | The title of the modal | string |
| 2 | A Lucide icon name | string |
The returned ModalInterface has the following properties/methods:
| Property/Method | Description |
|---|---|
Container | The content ScrollingFrame |
Open() | Opens the modal |
Close() | Closes the modal |
OnClose | Signal that fires when the modal is closed |
AddTab(name, icon) | Adds a tab, returns tab content frame |
SelectTab(name) | Switches to a specific tab |
AddFooterButton(icon, title, options) | Adds a dropdown button to the footer |
Example
GetSelectedRemote
Gets the currently selected remote instance in the UI.
Returns the selected remote instance and its type, or nil if nothing is selected.
ColorizeLuauCode
Colorizes Luau code using Cobalt's built-in syntax highlighter. Returns a RichText-compatible string.
Cobalt.UI.RemoteInfo
Functions for extending the remote info panel that opens when you click a remote.
CreateTab
Adds a custom tab to the remote info modal.
Returns (TabContent, TabUI) — the content frame you can parent elements to, and the tab UI frame.
BindToModalOpen
Binds a callback that fires whenever the remote info modal is opened.
Returns a cleanup function.
InterceptModalOpen
Adds an interceptor that can block the remote info modal from opening. Return false to block.
Returns a cleanup function.
AddFooterButton
Adds a custom footer button to a specific Remote Info tab.
Returns a cleanup function that removes the button.
DisableDefaultButtons
Disables the default footer buttons for a specific Remote Info tab.
Cobalt.UI.ContextMenu
Functions for adding custom right-click context menu options.
AddOption
Adds a custom option to a context menu.
| Arg | Description | Type |
|---|---|---|
| 1 | Which context menu to add to | "RemoteList" | "CallList" |
| 2 | A Lucide icon name | string |
| 3 | The option text | string |
| 4 | Callback receiving the relevant log or call data | function |
Returns a cleanup function.
Example