Detect when player has respawned

Hello.

I’ve been trying to check for the player’s respawn.
I’m using the :Died() event, and I’m seeking to check when the player has respawned to then run code.

Yes, I am aware that this has already been asked on some topic, but it doesn’t seem like it works.
How could I do that?

Thanks in advance,
Mehdi

9 Likes

You can use the Player.CharacterAdded event. It will fire every time the player’s character is added to the game.

40 Likes

Died should only be used in the case that you need to check the current character’s death and run functions for the death of a character, not for respawning. CharacterAdded, as mentioned above, will do that for you. If your code is in StarterCharacterScripts, respawning is implicitly handled for you, but use that only for scripts that the character would actually need hanging around.

11 Likes

When a player dies, his character is removed from workspace, and added back in there as soon as he’s back in the game. The CharacterAdded event is supposed to fire whenever the character is added to workspace, meaning when he first joined the game or when he died, or more precisely when he respawns, because the character isn’t just removed and added back when he dies, for example this could happen if the :LoadCharacter() method is ran, the Died event wouldn’t actually fire, because it’s supposed to fire whenever the character dies, but CharacterAdded would fire, because it will fire when he’s added.

13 Likes

Just noticed I never said thanks to anyone here nor did I mark a solution.
I used CharacterAdded and it works well. Thanks everyone!

12 Likes