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.

local Player = game.Players.LocalPlayer
local Char = script.Parent
Char.Humanoid.Health = Char.Humanoid.MaxHealth
while wait() do
  wait(.5)
	Char.Humanoid.MaxHealth = 100 + Player.Data.DefenseP.Value * 5
	Char.Keybind.Damage.Value = 10 + Player.Data.MeleeP.Value * 2
    Char.Humanoid.Health = Char.Humanoid.Health + 1
end

2 comments

0

Use the PlayerAdded event of the Players Service then CharacterAdded event of the player then the Died event of the Character's Humanoid

0

I tryed that ,could you show the scirpt to it?