I have this in a Server Script:
game.Players.PlayerAdded:connect(function(player) local died = true repeat wait() until player.Character local Humanoid = player.Character:WaitForChild("Humanoid") Humanoid.Died:connect(function() died = true -- If player died, change variable end) player.CharacterAdded:connect(function(character) if died then -- If the player died then print(player.Name .. " has been reapwned!") died = false else -- If the player didn't die then print(player.Name .. " has been loaded!") died = false end end) end)
Since my game features the ability to refresh your character with :LoadCharacter, this code is supposed to distinguish between loading your character and actually dieing. However when I test it, after death the script distinguishes the respawn as a "load". I think it's because the :Died event is taking to long to activate, but I'm not too sure. Any ideas?