If you have a coroutine and it’s running
And an event fires
Does the coroutine have to yield before the event can get processed?
Callback functions connected to events are ran in their own threads of execution.
local game = game
local runService = game:GetService("RunService")
local connection
local function onRenderStep()
connection:Disconnect()
print("Event thread: ", coroutine.running())
end
connection = runService.RenderStepped:Connect(onRenderStep)
print("Main thread: ", coroutine.running())
--Main thread: thread: 0xd6d575ed15c1a824
--Event thread: thread: 0xbcaafd949dd1d8a4