I also wanted to increase cash by 100 to the killer after each kill. Here is the script I used:
game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Folder",player) leaderstats.Name = "leaderstats" local currency1 = Instance.new("IntValue",leaderstats) currency1.Name = "Money" 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 currency1.Value = currency1.Value + 100 --This is the reward after the player died. end end end) end) end)
Could you please add Kills and Deaths to that script? Tysm!
Bit confused but hopefully this answers your question
Why don't you just add 2 other intvalues, name it "Deaths" and "Kills" then everytime a player dies or kills someone you add onto it? And also, you want 100 to go to the killer, but in your script you are giving 100 to the player that died
edited version of your script:
game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Folder",player) leaderstats.Name = "leaderstats" local currency1 = Instance.new("IntValue",leaderstats) currency1.Name = "Money" local deaths = Instance.new("IntValue",leaderstats) -- your new death value deaths.Name = "Deaths" local kills = Instance.new("IntValue",leaderstats) -- new kills value kills.Name = "Kills" player.CharacterAdded:connect(function(character) character:WaitForChild("Humanoid").Died:Connect(function() local tag = character.Humanoid:FindFirstChild("creator") if tag.Value ~= nil then -- also, you added another line of this. why? its useless since you already checked here local killer = game.Players[tag.Value] -- GET THE KILLER TO ADD, NOT THE PLAYER WHO DIED killer.leaderstats.Money.Value = killer.leaderstats.Money.Value + 100 -- reward killer killer.leaderstats.Kills.Value = killer.leaderstats.Kills.Value + 1 -- add a kill to the killer player.leaderstats.Deaths.Value = player.leaderstats.Deaths.Value + 1 -- add a death to the person that died (you already identified, player from playeradded) end end) end) end)
hope that helps