isparallel
Checks if the current thread is running in parallel.
Syntax
isparallel() -> booleanAliases
is_parallel
Returns
| Type | Description |
|---|---|
boolean | True if running in a parallel context |
Description
isparallel returns whether the current code is executing in a parallel Luau context (inside an Actor).
Example
if isparallel() then
print("Running in parallel!")
-- Safe to do parallel-safe operations
else
print("Running on main thread")
endUse in Actor
run_on_actor(someActor, [[
print("Is parallel:", isparallel()) -- true
]])
print("Is parallel:", isparallel()) -- false (main thread)Notes
- Returns
falseon the main game thread - Returns
truewhen running inside an actor viarun_on_actor
Related Functions
run_on_actor- Run code on an actorgetactors- Get all actors