> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# getscriptthread

> Real bulabildiginde bir script object ile iliskili Lua thread degerini dondurur. Argument object olmalidir. Function degerin ClassName field degerini okur ve bu field string degilse "not a valid Instance" firlatir. Kabul edilen ClassName degerleri Script, LocalScript ve ModuleScript degerleridir; diger degerler "Script expected" firlatir. Once script reference ile Real'in ScriptThreadCache degerini kontrol eder. Cache hit durumunda cached Luau thread degerini thread olarak dondurur. Cache miss durumunda Script degerleri RunContext Client icermelidir, aksi halde function "Expected a Script with RunContext set to Client" firlatir. Sonra the live Luau thread list uzerinde gezer, her thread node icin first weak thread reference degerinden LiveLuaRef degerine gider, missing thread data veya expired Script stored references degerlerini atlar ve her script reference degerini istenen script ile karsilastirir. Match bulursa bu Luau thread degerini thread olarak dondurur. Match bulunmazsa nil dondurur.

<div className="real-function-page">
  ```lua theme={null}
  getscriptthread(script: userdata): thread | nil
  ```

  ## Argümanlar

  <ParamField path={"script"} type={"userdata"} required>
    Aranacak Script object. Kabul edilen ClassName degerleri Script, LocalScript ve ModuleScript degerleridir.
  </ParamField>

  ## Dönüşler

  <ResponseField name={"thread"} type={"thread | nil"}>
    Iliskili Lua thread, veya matching live thread bulunamazsa nil.
  </ResponseField>

  ## Örnek

  Read the Luau thread associated with a supported script Instance when one is available.

  ```lua theme={null}
  local targetScript

  for _, descendant in ipairs(game:GetDescendants()) do
      if descendant:IsA("LuaSourceContainer") then
          targetScript = descendant
          break
      end
  end

  if targetScript then
      local thread = getscriptthread(targetScript)
      print(thread)
  end
  ```
</div>
