Decompiling scripts
Read client script and Luau function bytecode through the Internal Menu or decompile().
Roblox sends client-side scripts to your PC as compiled Luau bytecode. decompile turns that bytecode back into source you can read, search & learn from.
One script
In the Internal Menu, choose Decompile for a script in Scripts or right-click a script in Explorer and choose Decompile. The result opens in a source window with Copy Code and Open new Tab buttons.
You can also call decompile from a script. It returns the recovered source as a string, which you can write to the workspace:
Many scripts
A loop decompiles a whole folder of the game into a folder of your workspace.
What to expect
decompile yields while it works, then returns a string:
- On success, the reconstructed Luau source.
- On failure, an error. Use
pcallwhen you need to handle a timeout or unavailable bytecode and continue. - Bytecode works too. Pass the string from
getscriptbytecodeinstead of a script. - Luau functions work too. Pass a Luau function directly, or choose Decompile function from a supported function or stack-frame context menu in the Internal Menu.
Bytecode keeps the structure of a program, but not everything the author wrote. Comments & type annotations are never recovered, because they don't exist in bytecode.
What can't be decompiled
- Server scripts. A
Scriptthat runs on the server never reaches your PC. There's no bytecode to decompile. - Anything that stays on the server. Scripts in
ServerScriptService&ServerStorageare never replicated to clients. - Native C functions. These contain native code rather than Luau bytecode.
A whole place
saveinstance() saves the place you're in as a Roblox place file and decompiles its scripts on the way. Pass { Decompile = false } to skip the decompiling & save faster.
SaveInstance's ScriptTimeout limits how long each script decompilation waits, while DecompileTimeout limits the decompilation batch after bytecode capture. Both use seconds; DecompileTimeout does not limit the whole export. A timed-out native job can finish in a bounded background slot while the export continues. See SaveInstance options for defaults and failure handling.
Written for Lynx 0.747
Something unclear? Tell us on Discord