Actors
Discover parallel Actors, run source code inside their state, and open BindableEvent-backed channels across state boundaries.
Roblox runs Actor instances in separate Luau states so their scripts can execute in parallel. Those states are isolated from yours, which means code you want to run inside one has to be sent as source rather than as a closure.
The Guide: Actors & Parallel Luau chapter works through a full round trip. In brief:
Getting code into an actor
local actor = getactors()[1]
local id, channel = create_comm_channel()
channel.Event:Connect(function(...)
print("from the actor:", ...)
end)
run_on_actor(actor, ([[
local channel = get_comm_channel(%d)
channel:Fire("hello", isparallel())
]]):format(id))