Returns the thread a running script is executing on, or nil if it has none. The script must still be alive; a destroyed script has no thread to return.

Parameters

Instance
required
A running script instance.

Returns

thread or nil
The script’s thread, or nil.

Example

Errors