Skip to main content
Sets the current thread’s identity to identity and returns the level that was active before the call.
Every thread on Roblox carries an identity number that decides what the running script is allowed to touch.
Read the getthreadidentity page entry to learn more.

Parameters

Returns

number - the previous identity (the level that was active before this call). Useful for save/restore: capture the return, do your work at the new identity, then pass it back into a second call to restore.

Aliases

  • setidentity
  • set_thread_identity
  • setthreadcontext

Example

If you try to require() a ModuleScript, while having your identity level set to 2,
you will get an error: Lacking capability RobloxScript.
Always check parameters and return values when working with this library function.