Skip to content

getscriptbytecode

Notes on getscriptbytecode

This function should return nil if the script has no bytecode. This makes it easier to check for absence consistently across executors.

getscriptbytecode retrieves the bytecode of a LocalScript, ModuleScript, and Script.

function getscriptbytecode(script: BaseScript | ModuleScript): string | nil

Parameters

Parameter Description
script The script instance to retrieve the bytecode from.

Example

Reading the bytecode of a running script
1
2
3
4
5
local animate = game.Players.LocalPlayer.Character:FindFirstChild("Animate")

print(getscriptbytecode(animate)) -- Returns bytecode as a string

print(getscriptbytecode(Instance.new("LocalScript"))) -- Output: nil