Returns the compiled Luau bytecode of a LocalScript or ModuleScript as a string.
Pass a script Instance and the function returns the bytecode the engine compiled from its source. Returns nil when the client can’t reach the script.
Most commonly used to feed bytecode into a custom decompiler or disassembler. The built-in decompile() and disassemble() accept a script Instance directly and call getscriptbytecode() internally - reach for it yourself only when you need the raw bytes.
Parameters
Returns
string - the script’s compiled bytecode in binary form.
Example
LocalScript.Source and ModuleScript.Source are stripped to empty strings on the client - getscriptbytecode() is the only path left to a script’s raw bytes.