Syntax
run_on_actor(actor: Instance, source: string, ...arguments?: ..any)Aliases
runonactorArguments
| Name | Type | Description |
|---|---|---|
actor | Instance | Actor Instance whose thread should run the source. The value must be an Instance with ClassName Actor. |
source | string | Non-empty Luau source string to run on the Actor thread. |
...arguments? | ..any | Additional values passed to the dispatched source when supported. Unsupported values are passed as nil. |
Description
Runs Luau source on the thread associated with a target Actor Instance. The first argument must be an Instance whose ClassName is Actor, and the second argument must be a non-empty source string. Extra arguments after source are passed to the dispatched source when supported. The call returns no values and does not return values produced by the dispatched source. runonactor is an alias.
Call it with 3 parameter(s): actor, source, ...arguments. The argument table explains which values are required and which ones only refine the behavior.
It does not return data. Treat the call as an action and handle errors around the call site when needed.
Example
Run source on a resolved Actor thread.
local actor = getactors()[1]
if actor then
run_on_actor(actor, [[
print(getcurrentactor())
]])
end