> ## 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.

# setscriptable

> Zapisuje scriptable override dla Roblox property w scriptable override cache i zwraca previous scriptable state. Pierwszy argument musi byc Instance object, drugi argument musi byc string property name, a trzeci argument musi byc boolean. Jesli cache entry istnieje juz dla tego samego instance reference i property name, cached scriptable value jest zastepowana i zwracana jest stara wartosc z cache. Przy cache miss property name jest rozwiazywana przez Roblox property metadata i Instance class descriptor. Jesli descriptor nie istnieje albo rozwiazany field nie istnieje lub nie jest property entry, function zwraca nil. Gdy property entry zostanie znaleziona, function odczytuje scriptable state, zapisuje zadany boolean oraz property reference w scriptable override cache i zwraca previous scriptable state value. GameIndexHook i GameNewIndexHook pozniej uzywaja tego cache, tymczasowo ustawiajac property field scriptable flag dla jednego indexed read lub write, a potem przywracaja previous field flag.

<div className="real-function-page">
  ```lua theme={null}
  setscriptable(instance: Instance, property: string, value: boolean): boolean | nil
  ```

  ## Argumenty

  <ParamField path={"instance"} type={"Instance"} required>
    Instance object uzywana jako czesc scriptable override cache key.
  </ParamField>

  <ParamField path={"property"} type={"string"} required>
    Property name rozwiazywana przez Roblox property metadata i Instance class descriptor przy cache miss.
  </ParamField>

  <ParamField path={"value"} type={"boolean"} required>
    Scriptable override value zapisywany w scriptable override cache.
  </ParamField>

  ## Zwroty

  <ResponseField name={"previousState"} type={"boolean | nil"}>
    Previous cached scriptable value, previous scriptable state value, lub nil, gdy property nie moze zostac rozwiazana do property entry.
  </ResponseField>

  ## Przykład

  Temporarily change whether a property is scriptable, then restore the previous state when available.

  ```lua theme={null}
  local previous = setscriptable(workspace, "Name", true)
  print(previous)

  if previous ~= nil then
      setscriptable(workspace, "Name", previous)
  end
  ```
</div>
