When a RemoteEvent is invoked and there are no connections, the invocation is added to the queue for the RemoteEvent. Whenever the first connection is added to a RemoteEvent, it immediately fires the connection for every invocation in the queue. This can still happen if there was a connection that was previously disconnected; however, if the connection was disconnected by the script which the connection was connected from being destroyed, it will stop invocations from queueing.
Example of this issue:
Insert a RemoteEvent into ReplicatedStorage.
Insert two scripts into ServerScriptService with:
game:GetService"ReplicatedStorage":FindFirstChild"RemoteEvent".OnServerEvent:Connect(warn)
script:Destroy()
wait(10)
game:GetService"ReplicatedStorage":FindFirstChild"RemoteEvent".OnServerEvent:Connect(print)
Insert a local script into StarterPlayerScripts with:
wait(5)
game:GetService"ReplicatedStorage":WaitForChild"RemoteEvent":FireServer"abc"
Starting the game will cause nothing to be outputted.
If the first script is changed to
game:GetService"ReplicatedStorage":FindFirstChild"RemoteEvent".OnServerEvent:Connect(warn):Disconnect()
script:Destroy()
Then the output becomes
<username> abc
as the connection was disconnected using RBXScriptConnection:Disconnect()
causing the invocation to be added to the queue, and later invoke the connection defined in the second script.
Expected behavior: A connection disconnected by a script being destroyed should not stop invocations from being queued in a RemoteEvent.