Error when waiting on queued remote events

When the Wait method is used with OnServerEvent or OnClientEvent, it throws the following error for each queued event:

cannot resume non-suspended coroutine

The following scripts demonstrate this behavior:

-- Script; game.ServerScriptService

local remote = Instance.new("RemoteEvent")
remote.Parent = game.ReplicatedStorage
game.Players.PlayerAdded:Connect(function(player)
	-- Immediately send messages.
	for i = 1,3 do
		print("SEND",player,i)
		remote:FireClient(player,i)
	end
	wait(1)

	-- Tell client to start receiving messages.
	local sync = Instance.new("BoolValue")
	sync.Name = "Sync"
	sync.Parent = game.ReplicatedStorage
end)
-- LocalScript; game.ReplicatedFirst

-- Wait until server says to start receiving messages.
local sync = game.ReplicatedStorage:WaitForChild("Sync")

local remote = game.ReplicatedStorage:WaitForChild("RemoteEvent")
-- Use Wait to receive a message. Server sent 3 messages, so there are 3 queued up.
print("RECEIVE",remote.OnClientEvent:Wait())

-- expected:
--     RECEIVE 1
-- result:
--     cannot resume non-suspended coroutine
--     cannot resume non-suspended coroutine
--     cannot resume non-suspended coroutine

Reproduction:
RemoteEventWaitError.rbxl (13.6 KB)

4 Likes

After about a month, this issue is still present.

Getting this error just now.

script.Events.MinigameLoaded.OnClientEvent:wait()

Thanks for the simple repro case. We’re working on this issue right now, and will update when we have a fix.

1 Like

This is fixed now internally, and scheduled for release in either the next release or the release after that.

1 Like

Any ETA on this fix? I’m still getting the same error.

It’s on the client, but hidden behind a flag. You can keep a watch on this page to see when it becomes enabled:

1 Like

The fix is live now. Please let me know if you’re still seeing issues.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.