The script is in a normal script and in workspace
game.Players.PlayerAdded:Connect(function(Player) local hi = Player.Character local humanoid = hi:FindFirstChild("Humanoid") local leaderpoints = Player:FindFirstChild("leaderstats") humanoid.MaxHealth = leaderpoints.Durability.Value print(leaderpoints.Durability.Value) end)
Okay. Let's break it down. After you wait for the player to be added you're going to want to create your leaderstats. In this case, I'm going to make it a folder. Then we're going to want to create an IntValue inside of it called Durability. Then, we're going to find the character of the player. The way it works is it's going to wait for the player to load into the game, we're using Player.Name so it knows we're looking for a model with the name of your player. Then we're going to set the value of the leaderstats to the player's maxhealth.
game.Players.PlayerAdded:Connect(function(Player) local leaderstats = Instance.new("Folder") leaderstats.Parent = Player leaderstats.Name = "leaderstats" local durability = Instance.new("IntValue") durability.Parent = leaderstats durability.Name = "Durability" local humanoid = game.Workspace:WaitForChild(Player.Name).Humanoid local leaderpoints = Player:FindFirstChild("leaderstats") durability.Value = humanoid.MaxHealth print(leaderpoints.Durability.Value) end)
Edit:
game.Players.PlayerAdded:Connect(function(Player) local humanoid = game.Workspace:WaitForChild(Player.Name).Humanoid local leaderpoints = Player:FindFirstChild("leaderstats") humanoid.MaxHealth = leaderpoints.Durability.Value print(leaderpoints.Durability.Value) end)