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

# setthreadidentity

> Sets the identity for the current Luau thread, or for a provided Luau thread. Identity values are converted to integers and clamped to the supported range 0 through 12.

<div className="real-function-page">
  ```lua theme={null}
  setthreadidentity(thread?: thread, identity: number)
  ```

  ## Aliases

  * `set_thread_identity`
  * `setidentity`
  * `setthreadcaps`
  * `setthreadcontext`
  * `set_thread_context`

  ## Arguments

  <ParamField path={"thread"} type={"thread"}>
    Optional Luau thread to update. When provided as argument 1, identity must be passed as argument 2. If argument 1 is not a thread, it is treated as identity instead and the current thread is updated.
  </ParamField>

  <ParamField path={"identity"} type={"number"} required>
    Identity value to apply. It is converted to an integer, clamped to the range 0 with 12, and then applied.
  </ParamField>

  ## Example

  Set the identity on the current Luau thread, or on a thread argument when one is provided.

  ```lua theme={null}
  local previous = getthreadidentity()

  setthreadidentity(8)
  print(getthreadidentity())

  setthreadidentity(previous)
  ```
</div>
