I’ve noticed that when I code with deferred events enabled,
CharacterRemoving doesn’t fire when my player leaves the game. Only
PlayerRemoving does. However they both fire when immediate events are enabled. This is introducing some issues to my game because I know that immediate events are always enabled on online mode. I don’t know which one I should code with.
local PLAYERS = game:GetService("Players") PLAYERS.PlayerRemoving:connect(function(player) print("Player removing") --prints all the time player.CharacterRemoving:connect(function(character) print("Character removing") --only prints when immediate events are on character.AncestryChanged:connect(function() if character.Parent == nil then print("Character parent is nil") --only prints when immediate events are on end end) end) end)