setthreadidentity
Changes the security identity of the current thread.
Syntax
setthreadidentity(identity: number) -> ()
Also available as
setidentitysetthreadcontextset_identityset_thread_contextset_thread_identity
Parameters
| Parameter | Type | Description |
|---|---|---|
identity | number | An integer from 0 to 8. |
Description
Lowering the identity makes your code behave like a game script for permission checks; raising it gives access to APIs protected at that level. The change applies to the current thread and to threads it starts afterwards.
Example
setthreadidentity(2)
print(getthreadidentity())
print(pcall(function() return game:GetService("CoreGui").Name end))
setthreadidentity(8)
print(pcall(function() return game:GetService("CoreGui").Name end))
Notes
- Values outside 0 to 8 raise an error.
These are Game executor contracts. Check build requirements and session lifetimes before using them.
