I just found that now PlayerRemoving can execute before CharacterRemoving.
Previously such behaviour never occurred in testing, so I presume it is a recent addition.
The work around is to explicitly synchronise these two event callbacks. However, it simply is not logical to fire PlayerRemoving before (or together with) CharacterRemoving.
game.Players.PlayerAdded:Connect(function(player)
player.CharacterRemoving:Connect(function(char)
local t = 1
while t>0 do
print(tick(), "CharacterRemoving")
t = t - wait()
end
print(tick(), "CharacterRemoving DONE")
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
local t = 1
while t>0 do
print(tick(), "PlayerRemoving")
t = t - wait()
end
print(tick(), "PlayerRemoving DONE")
end)