Skip to content
Scripts & runtimeOverview

getscriptclosure

Represents access to a script's callable representation.

Aliasesgetscriptfunction

Details#

Obtains a callable representation from a script's available compiled data. Obtaining it is distinct from executing it, and does not reproduce all captured live state. Unavailable bytecode may cause an error or no callable result.

Examples#

Example

Luau
local ownScript = Instance.new("LocalScript")
local ok, closure = pcall(getscriptclosure, ownScript)
print(ok, type(closure))
ownScript:Destroy()