Advertisement
HowToRoblox

CashPerKillScript

Nov 4th, 2019
13,329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. game.Players.PlayerAdded:connect(function(player)
  2.    
  3.     local leaderstats = Instance.new("Folder",player)
  4.     leaderstats.Name = "leaderstats"
  5.  
  6.     local cash = Instance.new("IntValue",leaderstats)
  7.     cash.Name = "Cash"
  8.     cash.Value = 0
  9.  
  10.     local kills = Instance.new("IntValue",leaderstats)
  11.     kills.Name = "Kills"
  12.     kills.Value = 0
  13.    
  14.  
  15.     player.CharacterAdded:connect(function(character)
  16.         character:WaitForChild("Humanoid").Died:connect(function()
  17.    
  18.             local CreatorTag = character.Humanoid:FindFirstChild("creator")
  19.  
  20.             if CreatorTag and CreatorTag.Value then
  21.    
  22.                 local stats = CreatorTag.Value:WaitForChild("leaderstats")
  23.  
  24.                 stats["Cash"].Value = stats["Cash"].Value + 20
  25.                 stats["Kills"].Value = stats["Kills"].Value + 1        
  26.             end
  27.         end)
  28.     end)
  29. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement