getscriptbytecode — dump a script's compiled bytecode
get-script-bytecodeRetrieve compiled Luau bytecode for a Roblox script by its path, returning the total byte count and a hex preview.
Instructions
Retrieve the compiled Luau bytecode for a script via the executor's getscriptbytecode. The script is resolved from a Luau expression (typically a path to a LuaSourceContainer, e.g. 'game.ReplicatedStorage.Module') via loadstring('return ' .. expr). Returns the total byte count and a hex preview of the first previewBytes bytes (the full bytecode is not shipped across the bridge). Requires getscriptbytecode — type-guarded and pcall-wrapped, returning { error } when missing or on failure. Returns { byteCount, hexPreview } or { error }. Signature: { scriptPath: string, previewBytes: any?, threadContext: number? }. Phase: orchestrate; cost=high; idempotency=read-only. Requires: active-client, resolved-target. Capabilities: getscriptbytecode. Produces: structured-observation. Safety: read-only. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scriptPath | Yes | Luau expression resolving to a LuaSourceContainer, e.g. 'game.ReplicatedStorage.Module'. Evaluated as `return <expression>`. | |
| previewBytes | No | How many leading bytecode bytes to include as a hex preview (default 64). | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. |