Advertisement
vicon23
Nov 17th, 2024 (edited)
51
0
Never
This is comment for paste Kills/Death Script
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local Players = game.Players
  2.  
  3. Players.PlayerAdded:Connect(function(player)
  4.  
  5.     local kills = Instance.new("IntValue")
  6.     kills.Name = "Kills"
  7.     kills.Value = 0
  8.     kills.Parent = leaderstats
  9.  
  10.     local Deaths = Instance.new("IntValue")
  11.     Deaths.Name = "Deaths"
  12.     Deaths.Value = 0
  13.     Deaths.Parent = leaderstats
  14.  
  15.     wait(1)
  16.     local Stats = leaderstats:Clone()
  17.     Stats.Parent = player
  18.     player.CharacterAdded:connect(function(Character)
  19.         local Humanoid = Character:FindFirstChild "Humanoid"
  20.         Deaths.Value = Deaths.Value + 1
  21.         if Humanoid then
  22.             Humanoid.Died:connect(function()
  23.                 for i, Child in pairs(Humanoid:GetChildren()) do
  24.                     if Child:IsA('ObjectValue') and Child.Value and Child.Value:IsA('Player') then
  25.                         local Killer = Child.Value
  26.                         if Killer:FindFirstChild 'leaderstats' and Killer.leaderstats:FindFirstChild "Kills" then
  27.                             local Kills = Killer.leaderstats.Kills
  28.                             Kills.Value = Kills.Value + 1
  29.                         end
  30.                         return
  31.                     end
  32.                 end
  33.             end)
  34.         end
  35.     end)
  36. end)
  37.  
  38. If I already have the leaderstats "Folder" thingy should I make it this? Or should I make it a different way? ^
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement