getscriptthread
Returns a thread associated with a client script or ModuleScript.
getscriptthread(script: LocalScript | ModuleScript | Script) -> thread?
| Parameter | Type | Description |
|---|
script | LocalScript, ModuleScript, or client Script | Script whose thread should be found |
| Type | Description |
|---|
thread? | The associated thread, or nil when none is available |
local runningScript = getrunningscripts()[1]
local thread = runningScript and getscriptthread(runningScript)
if thread then
print(coroutine.status(thread))
print(getscriptfromthread(thread) == runningScript) -- true
else
warn("No running script thread was available")
end