> ## 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 a Luau thread and returns no values. If argument 1 is a thread, argument 2 is required and must be a number; that thread is targeted. Otherwise argument 1 is required and must be a number, and the current thread is targeted. The number is read with integer conversion, clamped below 0 to 0 and above 12 to 12, then passed to Real. Real stores the identity and the matching IdentityToCapabilities result on the thread object, and also updates the TLS identity data structureure when one is available. Aliases call the same function.

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

  ## Алиасы

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

  ## Аргументы

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

  ## Пример

  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>
