Studio
Studio is an internal utility system that wraps common plugin APIs with a smaller, typed surface.
Fetch it with Dependency(Studio) from one of your own systems.
plugin
Exposes the underlying Plugin instance.
getMouse()
Activates the plugin and returns the mouse reference.
Type
ts
getMouse(exclusive = false): PluginMousecreateAction()
Creates an Action wrapper.
Type
ts
createAction(
id: string,
name: string,
statusTip: string,
icon?: string,
allowBinding?: boolean
): ActionselectTool()
Selects a Studio ribbon tool.
Type
ts
selectTool(button: Enum.RibbonTool, position = UDim2.fromScale(0.5, 0.5)): voidsaveSelection()
Attempts to save the current selection.
Type
ts
saveSelection(saveLocally: boolean, suggestedFileName?: string): Promise<boolean>Notes
- If nothing is selected, this returns
falseimmediately. - In the current implementation,
saveSelection(true)callsPlugin.SaveSelectedToRoblox()and returnstrue. saveSelection(false, suggestedFileName)callsPlugin.PromptSaveSelection(suggestedFileName)and returns that result.
requestAssetId()
Prompts the user for an existing asset id of a supported asset type.
Usage
ts
const assetId = await this.studio.requestAssetId("Model");openScript()
Opens a script and returns the same object.
Type
ts
openScript<T extends LuaSourceContainer>(source: T, lineNumber?: number): TgetSelection()
Returns the current Studio selection.
Type
ts
getSelection(): Instance[]select()
Sets the current Studio selection.
Type
ts
select(obj?: Instance | Instance[]): voidCalling select() with no argument clears the selection.
onSelectionChanged()
Registers a callback for selection changes.
Type
ts
onSelectionChanged(fn: (selection: Instance[]) => void): voidNotes
- The callback receives a fresh array from
Selection:Get()each time the event fires. - The connection is tracked automatically and cleaned up when the plugin unloads.
Usage
ts
import { Dependency, Studio, System } from "@rbxts/comet";
@System()
export class SelectionWatcherSystem {
private studio = Dependency(Studio);
constructor() {
this.studio.onSelectionChanged((selection) => {
print(`Selected ${selection.size()} instances`);
});
}
}