Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to add kills to leaderstats with currency?

Asked by 2 years ago

Hello! I've made leaderstats with currency Script is

game.Players.PlayerAdded:connect(function(player)
 local folder = Instance.new("Folder",player)
 folder.Name = "leaderstats"
 local currency1 = Instance.new("IntValue",folder)
 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)

Is this possible to add kills into my leaderstats, and if also possible kills with death? Thank you so much!

0
I know how to do deaths and currency but not kills MarcTheRubixQb 153 — 2y
0
can you make deaths so I could make kills using deaths as example nikitos54327 70 — 2y
0
Ok I put it as an answer I hope ithelps MarcTheRubixQb 153 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

Here is the death and currency script

game.Players.PlayerAdded:connect(function(player)
 local folder = Instance.new("Folder", player)
 folder.Name = "leaderstats"
 local currency1 = Instance.new("IntValue", folder)
 currency1.Name = "Money"
 local DeathCount = Instance.new("IntValue", folder)
 DeathCount.Name = Deaths
 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.
     DeathCount.Value = DeathCount.Value + 1
    end
   end
  end)
 end)
end)

Hope this helps! Sorry I could not make a kill stat.

0
Thanks so much! I think I can make kills now nikitos54327 70 — 2y
Ad

Answer this question