ReferenceReflection

getthreadidentity

Returns the security identity of the thread that calls it.

Syntax

getthreadidentity() -> number

Also available as

getidentitygetthreadcontextget_identityget_thread_contextget_thread_identity

Returns

TypeDescription
numberThe current thread's identity, from 0 to 8.

Description

The engine gives every thread an identity that decides which APIs it may use. Game LocalScripts run at 2, CoreScripts at 4 or higher, and your scripts at the executor identity. A thread created by your code inherits your identity.

Example

print(getthreadidentity())

task.spawn(function()
    print(getthreadidentity())
end)

These are Game executor contracts. Check build requirements and session lifetimes before using them.