Exactly what the title says. I'll elaborate more. Let's say I kill a player with 100 points. when the player is killed, it resets the dead player's points to zero and you get all of the player's points.
Here's what I have so far.
game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player -- Display an 'IntValue' on leaderboard local Power = Instance.new("IntValue") Power.Name = "Power" Power.Value = 150 Power.Parent = leaderstats player.CharacterAdded:connect(function(character) character:WaitForChild("Humanoid").Died:connect(function() local tag = character.Humanoid:FindFirstChild("creator") if tag ~= nil then if tag.Value ~= nil then Power.Value = Power.Value +10 end end end) end) end)
most game just spawn lots of "points" on the ground when one player die, and another player just walk through the points and collect all of them. I think that is the easiest way.
The script above is another way, the hard way. you only have half of the script. you are missing the other half. When a sword or a bullet touch something, it needs to find out whether it is a stand alone object, or whether it is part of humanoid. if it is part of humanoid, where is the tag. it can go scarf -> helmet -> head -> character, then go down again, character -> humanoid, create a tag in this level.
after the 2nd part of the script, your above part of script will work