Advertisement
Guest User

Untitled

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