getscriptbytecode
Returns a script's compiled bytecode.
Syntax
getscriptbytecode(script: LuaSourceContainer) -> string
Also available as
getscriptbytecodeget_script_bytecodedump_string
Parameters
| Parameter | Type | Description |
|---|---|---|
script | LuaSourceContainer | A LocalScript, Script or ModuleScript. |
Returns
| Type | Description |
|---|---|
string | The script's compiled Luau bytecode. |
Description
Game scripts reach the client as bytecode, not source. This returns those bytes, decoded from the client's storage format, ready for decompile or your own disassembler.
Example
local bytecode = getscriptbytecode(game.Players.LocalPlayer.PlayerScripts.ClientMain)
print(#bytecode, "bytes, version", string.byte(bytecode, 1))
Notes
- A script without bytecode, or one whose bytecode cannot be read, raises an error.
These are Game executor contracts. Check build requirements and session lifetimes before using them.
