Firstly, I’m assuming this is a server script. It’s generally a good practice to not only have a PlayerAdded connection, but to loop over all the players (from Players:GetPlayers()) if there is any chance that your PlayerAdded connection is going to be made after someone has joined the server.
Likewise, if anything in your PlayerHandler:SetupPlayer() yields, it’s possible that the player’s character has loaded before you reach line where you connect to CharacterAdded. In this case, their initially-spawned character will not report their death, only characters that they respawn subsequently. You can resolve this by checking if player.Character already exists and attach the Died connection to it, in addition to listening for CharacterAdded (which is still needed for subsequent respawns).
By the time you reach
player.CharacterAdded:Connect
The character has already spawned.
Do
function characterAdded(character)
character:WaitForChild("Humanoid").Died:Connect(function()
print( player.Name.." has died")
end)
end
Players.PlayerAdded:Connect(function(player)
PlayerHandler:SetupPlayer(player)
player.CharacterAdded:Connect(characterAdded)
if player.Character then
characterAdded(player.Character)
end
end)