Best way to detect when a character is removed

I’m creating tables with indices as character models, which are removed (set to nil) when the character no longer exists. Which events are always fired when the character model is removed (e.g. when the player controlling the character leaves the game, when the Humanoid dies), and which one(s) is/are the most reliable for that purpose?

These are some of the possibilities I know of; I just don’t know what the most optimal event is:

  • Instance.AncestryChanged: what I’m currently using
  • Instance.Destroying
  • Instance.Humanoid.Died: not an option unless it’s fired when a player leaves the game
  • Instance:GetPropertyChangedSignal("Parent")
1 Like

Definitely use :GetPropertyChangedSignal. This is far better since it will only check for a specific property that was changed.

2 Likes

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