Scripts

getcallingscript

Returns the script associated with the current calling context.

Syntax

getcallingscript(): Instance | nil

Returns

NameTypeDescription
scriptInstance | nilScript instance associated with the context, or nil.

Description

Returns the script associated with the current calling context.

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)