run_on_actor
Runs Luau source on an actor.
Syntax
run_on_actor(actor: Instance, source: string, ...) -> nil
Parameters
| Parameter | Type | Description |
|---|---|---|
actor | Instance | The actor instance that should run the operation. |
source | string | Luau source code to compile or execute. |
... | ... | Additional arguments forwarded to the target. |
Returns
| Type | Description |
|---|---|
nil | This function does not return a value. |
Description
run_on_actor is part of the Actors library. Actor helpers target Roblox's parallel actor scheduler. Code sent to an actor runs in that actor's isolated Luau context rather than the current script thread.
The operation is performed immediately using the arguments supplied at the call site.
The aliases run_on_actors(...) resolve to the same implementation.
Example
local actor = getactors()[1]
run_on_actor(actor, [[print("running from actor")]])
Notes
- Aliases:
run_on_actors(...). - Actor calls run in a separate parallel state; data passed into the actor must be representable in Luau.