getscriptfromthread — useful for interacting with or inspecting the thread a script is running on.
Parameters
Returns
thread? - the coroutine thread associated with the given script, or nil if the script is not currently running.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
getscriptfromthread — useful for interacting with or inspecting the thread a script is running on.
getscriptthread(script: LuaSourceContainer): thread?
| Parameter | Type | Description |
|---|---|---|
script | LuaSourceContainer | The script whose thread you want to retrieve. |
thread? - the coroutine thread associated with the given script, or nil if the script is not currently running.
local MapManager = game:GetService("ReplicatedStorage").Modules.Client.UI.MapManager
local Thread = getscriptthread(MapManager) -- May be multiple items
-- How would you find the exact thread? by a stupid hook on task.spawn checking the name, then line count and hooking it.
-- or SOMEONE could make a new funciton for that, since threads are neglected
-- Everything's for functions, even though theyre lame and easily identifable, but threads cant be identifed in any way less than a hook, which is time consuming.
-- After the parents death the thread still runs.
for _, script in getnilinstances() do
if not script:IsA("LocalScript") then
continue
end
local thread = getscriptthread(script);
if thread and coroutine.status(thread) ~= "dead" then
task.cancel(thread)
end
end