getscriptthread
Returns the Lua thread associated with a script object when Real can find one. The argument must be object. The function reads the value’s ClassName field and raises “not a valid Instance” if that field is not a string. Accepted ClassName values are Script, LocalScript, and ModuleScript; any other value raises “Script expected”. It first checks Real’s ScriptThreadCache by the script reference. On a cache hit, it returns the cached Luau thread as a thread. On a cache miss, Script values must have RunContext Client or the function raises “Expected a Script with RunContext set to Client”. It then walks the live Luau thread list, follows each thread node’s first weak thread reference to LiveLuaRef, skips missing thread data or expired Script stored references, and compares each script reference with the requested script. If it finds a match, it returns that Luau thread as a thread. If no match is found, it returns nil.