I want to do this because I need to fix a bug in my game and the only way to fix it It I found was to reset the character by going to the menu and pressing r, but I want it to reset by itself.
COMMUNITY QUESTION
Ok this may sound strange but how do I have the players character reset when their health is 0?
1 answer
Well, if you mean to respawn the player then you can do:
Humanoid.Died:Connect(function()--Define Humanoid. Detects when humanoid dies.
game:GetService("Players"):GetPlayerFromCharacter(Character):LoadCharacter()--Define the character of a player. Respawns the player, that the "GetPlayerFromCharacter" returns. You can replace the part getting the player, but yoou must keep ":LoadCharacter()"
end)
You can use Player.CharacterAdded to detect when the player respawns. use this in a server script. If this is not the thing, that you are looking for, then reply. I'll try to help. Also, if you want remove the comments which are labeled as a green color, then remove them. Have a nice day!
This discussion is preserved as it was. New answers, comments, and votes are closed.
