VINDICTA
Actors · Function Unregistered
Bunni.fun
ChocoSploit
Cryptic
Potassium
Seliware
SirHurt
Solara
Velocity
Volcano
Volt
Wave
Xeno

run_on_thread

Runs code on a specific actor thread.

Unregistered
This function is not registered within sUNC, your executor may/may not have this.
function run_on_thread(actor_thread: thread, script: string, channel_data?: any): ()

Synopsis

How it works

Executes a function on a specific Luau thread (coroutineCoroutineA cooperatively-scheduled thread of execution in Luau. Each coroutine has its own lua_State (stack + call frames). Can be suspended with coroutine.yield() and resumed with coroutine.resume(). Roblox's task library uses coroutines internally.). Takes a thread reference and a function, then resumes the thread with the function injected into its execution context. This is lower-level than run_on_actor — it targets a specific lua_State rather than an Actor.

Thread injection

The function is pushed onto the target thread's stack and executed on the nextnext()Table traversal primitive. next(t, key) returns the next key-value pair after key, or nil when done. next(t, nil) returns the first pair. The underlying function used by pairs(). Traversal order is not guaranteed. scheduler cycle. The target thread must be in a yieldedYieldPausing a Luau coroutine/thread, returning control to the scheduler. The thread resumes later when the yielding condition is met (e.g., task.wait timer expires, HTTP response arrives). Implemented via coroutine.yield(). or suspended state. If the thread is currently running, the function is queued for deferred execution.

Usage

Run on first thread
run_on_thread(getactorthreads()[1], "print('Hello World!')")

Parameters

actor_thread thread
The actor thread to execute code on.
script string
The Luau source code to execute.
channel_data any optional
Data passed as ... to the script. Cannot be tables or functions.
Actor Availability
Not all games contain actors. Check getactorthreads() length before calling.