Guest User

Untitled

a guest
Dec 8th, 2019
86
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. killData12 = game:GetService("DataStoreService"):GetDataStore("killData")
  3.  
  4.  
  5. game.Players.PlayerAdded:Connect(function(Player)
  6. local LB = Instance.new("IntValue")
  7. LB.Name = "leaderstats"
  8.  
  9.  
  10.  
  11. local r = Instance.new("IntValue")
  12. r.Name = "death"
  13. r.Value = killData12:GetAsync(Player.userId) or 0
  14.  
  15.  
  16.  
  17.  
  18.  
  19. LB.Parent = Player
  20.  
  21. r.Parent = LB
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29. Player.CharacterAdded:Connect(function(char)
  30. Player.Robbing.Value = false
  31. Player.CashCollected.Value = 0
  32. Player.CharacterAdded:connect(function(character)
  33. character:WaitForChild("Humanoid").Died:connect(function()
  34. local tag = character.Humanoid:FindFirstChild("creator")
  35. if tag ~= nil then
  36. if tag.Value ~= nil then
  37. r.Value = r.Value + 1 --This is the reward after the player died.
  38.  
  39. else
  40. r.Value = r.Value - 0
  41.  
  42. end
  43. end
  44. end)
  45. end)
  46.  
  47. end)
  48. end)
  49.  
  50.  
  51.  
  52. game.Players.PlayerRemoving:Connect(function(plr)
  53.  
  54. killData12:SetAsync(plr.userId, plr.leaderstats.kill.Value)
  55.  
  56.  
  57. end)
RAW Paste Data