Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to add kills to leaderstats with currency?

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!

3 comments

0

I know how to do deaths and currency but not kills

0

can you make deaths so I could make kills using deaths as example

0

Ok I put it as an answer I hope ithelps

1 answer

✓ Accepted answer

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.

1 comment

0

Thanks so much! I think I can make kills now

This discussion is preserved as it was. New answers, comments, and votes are closed.