Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i reset the players health everytime he dies?

Asked by 5 years ago

Im trying to give the player his health back after he dies so its not just slowly regenerating back.I tried it with a StarterCharacterScript but when the player dies then the script is also gone and on the server side i dont know how to do that Thanks for the help.

Thats the playerscript for the health but its fine like that i think but now i want to set the players health to maxhealth after he respawned.

1local Player = game.Players.LocalPlayer
2local Char = script.Parent
3Char.Humanoid.Health = Char.Humanoid.MaxHealth
4while wait() do
5  wait(.5)
6    Char.Humanoid.MaxHealth = 100 + Player.Data.DefenseP.Value * 5
7    Char.Keybind.Damage.Value = 10 + Player.Data.MeleeP.Value * 2
8    Char.Humanoid.Health = Char.Humanoid.Health + 1
9end
0
Use the PlayerAdded event of the Players Service then CharacterAdded event of the player then the Died event of the Character's Humanoid SerpentineKing 3885 — 5y
0
I tryed that ,could you show the scirpt to it? valledestroy 54 — 5y

Answer this question