Skip to content
Saiko

run_on_actor

Runs a Luau source string in the given actor's own state. Every argument after the source is passed to the script and reaches it as ... .

Signature

luau
run_on_actor(actor: Actor, source: string, ...any): ()

Parameters

actorActor

The actor whose state runs the code, for example one of the results of getactors.

sourcestring

Luau source to run. It is a separate state, so none of your locals are visible to it.

......any

Values handed to the script. Several can be passed, and tables are accepted.

Returns

Nothing.

Note

Example

luau
local actor = getactors()[1]

run_on_actor(actor, [[
    local data, a, b = ...
    print(data.name, a + b, data.target == workspace) --> saiko 3 true
]], { name = "saiko", target = workspace }, 1, 2)