Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. function PlayerEntered(newPlayer)
  2.  
  3. end
  4.  
  5. game.Players.PlayerAdded:Connect(function(plr)
  6. local a = Instance.new("Folder",plr)
  7. a.Name = "leaderstats"
  8. local m = Instance.new("IntValue",a)
  9. m.Value = 0
  10. m.Name = "Money"
  11. local x = Instance.new("IntValue",a)
  12. x.Value = 15
  13. x.Name = "Skills"
  14. end)
  15.  
  16. game.Players.ChildAdded:connect(PlayerEntered)
  17.  
  18. game.ReplicatedStorage.BuyItem.OnServerEvent:Connect(function(plr,Money)
  19. if plr.leaderstats.Money.Value >= Money.Price.Value then
  20. plr.leaderstats.Money.Value = plr.leaderstats.Money.Value - Money.Price.Value
  21. local newMoney = Money:Clone()
  22. local oldMoney = plr.Backpack:FindFirstChildOfClass("Tool") or plr.Character:FindFirstChildOfClass("Tool")
  23. oldMoney:Destroy()
  24. newMoney.Parent = plr.Backpack
  25. end
  26. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement