So i made a script that is supposed to upgrade your max health but i tried making it so it saves even after your death But the script didnt work Here is the script:
local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local respawnTime = 3
player.CharacterAdded:Connect(function(char)
local humanoid = char:WaitForChild("Humanoid")
if humanoid then
humanoid.Died:Connect(function()
wait(respawnTime)
player.Character.Humanoid.MaxHealth = leaderstats.MaxHealth.Value
player.Character.Humanoid.Health = leaderstats.MaxHealth.Value
end)
end
end)

2 comments
Also just a tip: you don't need to check if 'humanoid' exists if you're using WaitForChild.
Im trying to get the maxhealth from the leaderstats doe