Yuari
Documentation
Docs/Script/getscriptclosure

getscriptclosure

Compiles a script and returns it as a function. getscriptfunction is an alias.

Syntax

getscriptclosure(script: Instance) -> function

Parameters

ParameterTypeDescription
scriptInstanceThe script value used by the call.

Returns

TypeDescription
functionIt as a function

Description

getscriptclosure is part of the Script library. Script helpers inspect scripts loaded by the client, their bytecode and the Luau threads created for them.

The call is read-only: it resolves the current value when invoked and does not change the underlying state.

The aliases getscriptfunction(script) resolve to the same implementation.

Example

local script = getscripts()[1]
print(getscriptclosure(script), getscriptfunction(script))

Notes

  • Aliases: getscriptfunction(script).
  • Script data reflects the client's live script objects and may change after execution.