getscriptbytecode

Gets processed Luau bytecode for a script.

Syntax

getscriptbytecode(script: CoreScript | LocalScript | ModuleScript | Script) -> string

Parameters

ParameterTypeDescription
scriptCoreScript, LocalScript, ModuleScript, or client ScriptThe script

Returns

TypeDescription
stringBinary Luau bytecode

Description

getscriptbytecode returns the bytecode associated with the script. It does not return source text.

Example

local module = getloadedmodules()[1]
if module then
    local bytecode = getscriptbytecode(module)
    print("Bytecode length:", #bytecode)
    writefile("module-bytecode.bin", bytecode)
end

Notes

  • If Volt cannot retrieve bytecode, the function raises an error
  • Luau strings preserve embedded null bytes in the returned data
  • Use decompile(script) when you need source text rather than interpreting this payload directly

Aliases

  • dumpstring