What i'm trying to do is make a script that reads the leaderstat "Health" and when it changes it updates the maxhealth of that player. (It also needs to be able to make it so they keep the max health even after death.) I am also going to be looking into the data store to save the IntValue and load it when a player leaves/joins.
I have been looking around the wiki and I really haven't had any luck.
I was trying to do a localscript that's placed within the StarerGUI... Here is the script..
stat = "Health"
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
local p = game.Players.LocalPlayer
character.Humanoid.MaxHealth = p.leaderstats:FindFirstChild(stat)
end)
end)
What it currently does is only gets the stat, I added in a few prints and it only got the stat = "Hleath"

1 comment
Nope, it still doesn't seem to work correctly. :/