Syntax
getcallingscript(): Instance | nilReturns
| Name | Type | Description |
|---|---|---|
script | Instance | nil | Script Instance associated with the current Luau thread, or nil. |
Description
Returns the Script Instance associated with the current Luau thread, or nil when no script is associated with it.
Call it without parameters. The function reads the needed context from the current runtime state.
It returns script (Instance | nil). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Example call with placeholder values.
local result = getcallingscript()
print(result)