Instance.Destroying firing out of order / late

Currently, as of 6/11/24, the <Instance>.Destroying event fires late, resulting in events being received out of order by game logic.

To reproduce, run the following code:

local Players = game:GetService("Players")

local function PlayerAdded(Player)	
	Player.CharacterAdded:connect(function(Character)
		warn("Player.CharacterAdded fired")
		
		Character.Destroying:connect(function()
			warn("Character.Destroying fired")
		end)
	end)
	
	Player.CharacterRemoving:connect(function(Character)
		warn("Player.CharacterRemoving fired")
	end)
end

if #Players:GetPlayers() > 0 then
	for _, Player in pairs(Players:GetPlayers()) do
		coroutine.wrap(PlayerAdded)(Player)
	end
end
Players.PlayerAdded:connect(PlayerAdded)

Observe that Player.CharacterAdded is fired and received before Character.Destrying is fired and received. This issue occurs regardless of signal behavior, even if it’s set to Immediate:

Player.CharacterAdded fired
Player.CharacterRemoving fired
Player.CharacterAdded fired
Character.Destroying fired

Expected behavior

It is expected that Instance.Destroying would not fire late, and would be received in-order like any other signal. Using the code above, this would be the expected output:

Player.CharacterAdded fired
Character.Destroying fired
Player.CharacterRemoving fired
Player.CharacterAdded fired
4 Likes

Thanks for the report! Looking for someone at Roblox to check this out.

1 Like