ReferenceScripts

getscriptbytecode

Returns a script's compiled bytecode.

Syntax

getscriptbytecode(script: LuaSourceContainer) -> string

Also available as

getscriptbytecodeget_script_bytecodedump_string

Parameters

ParameterTypeDescription
scriptLuaSourceContainerA LocalScript, Script or ModuleScript.

Returns

TypeDescription
stringThe 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

These are Game executor contracts. Check build requirements and session lifetimes before using them.