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

> Roblox property の scriptable override を scriptable override cache に保存し、previous scriptable state を返します。最初の引数は Instance object、2 番目の引数は string property name、3 番目の引数は boolean である必要があります。同じ instance reference と property name の cache entry がすでに存在する場合、cached scriptable value は置き換えられ、古い cached value が返されます。cache miss の場合、property name は Roblox property metadata と Instance class descriptor で解決されます。descriptor が存在しない場合、または解決された field が存在しないか property entry ではない場合、この function は nil を返します。property entry が見つかった場合、function は scriptable state を読み取り、要求された boolean と property reference を scriptable override cache に保存し、previous scriptable state value を返します。GameIndexHook と GameNewIndexHook は後でこの cache を使用し、単一の indexed read または write の間だけ property field scriptable flag を一時的に設定し、その後 previous field flag を復元します。

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

  ## 引数

  <ParamField path={"instance"} type={"Instance"} required>
    scriptable override cache key の一部として使われる Instance object。
  </ParamField>

  <ParamField path={"property"} type={"string"} required>
    cache miss 時に Roblox property metadata と Instance class descriptor で解決される property name。
  </ParamField>

  <ParamField path={"value"} type={"boolean"} required>
    scriptable override cache に保存する scriptable override value。
  </ParamField>

  ## 戻り値

  <ResponseField name={"previousState"} type={"boolean | nil"}>
    Previous cached scriptable value、previous scriptable state value、または property が property entry に解決できない場合は nil。
  </ResponseField>

  ## 例

  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>
