Comet
Comet exposes the framework bootstrap API. In a typical plugin, you call these methods in order: createApp(), addPaths(), then launch().
createApp()
Registers unload handling and sets the plugin name used for the toolbar.
Type
ts
createApp(name: string, enabledWhileRunning = false): voidNotes
namebecomes the toolbar name used by GUI.- If Studio is currently running and
enabledWhileRunningisfalse, this call becomes a no-op. - Unload cleanup is registered here, so call this before launching comet.
Usage
ts
import { Comet } from "@rbxts/comet";
Comet.createApp("My Plugin");addPaths()
Requires modules from an instance so decorated systems can register themselves.
Type
ts
addPaths(path?: Instance, recursive = false): voidNotes
- Although the signature marks
pathas optional, the implementation asserts that a valid instance is present at runtime. - When
recursiveistrue, comet scans descendants. Otherwise it scans only direct children. - Only
ModuleScriptchildren are loaded. - If Studio is currently running and the app was not created with
enabledWhileRunning = true, this call becomes a no-op.
Usage
ts
import { Comet } from "@rbxts/comet";
Comet.addPaths(script.Parent!.WaitForChild("systems"), true);configureLogger()
Configures the shared Logger instance used by comet.
Type
ts
configureLogger(level: LogLevel, showLevel = true, showPluginName = false): voidNotes
showLevelcontrols whether prefixes such as[WARN]are included.showPluginNameadds the app name fromcreateApp()as a prefix.- This updates the logger at runtime.
Usage
ts
import { Comet, LogLevel } from "@rbxts/comet";
Comet.configureLogger(LogLevel.ERROR, false, false);launch()
Initializes registered systems, resolves queued dependencies, and starts lifecycle hooks.
WARNING
Call this only after createApp() and addPaths() have run.
Type
ts
launch(): voidNotes
onInit()runs before anyonStart(),onRender(), oronHeartbeat()hook is attached.onStart()is spawned withtask.spawn().onRender()andonHeartbeat()are connected throughRunServiceand tracked for cleanup.- If Studio is currently running and the app was not created with
enabledWhileRunning = true, this call becomes a no-op.
Usage
ts
import { Comet } from "@rbxts/comet";
Comet.launch();