Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function PlayerEntered(newPlayer)
- end
- game.Players.PlayerAdded:Connect(function(plr)
- local a = Instance.new("Folder",plr)
- a.Name = "leaderstats"
- local m = Instance.new("IntValue",a)
- m.Value = 0
- m.Name = "Money"
- local x = Instance.new("IntValue",a)
- x.Value = 15
- x.Name = "Skills"
- end)
- game.Players.ChildAdded:connect(PlayerEntered)
- game.ReplicatedStorage.BuyItem.OnServerEvent:Connect(function(plr,Money)
- if plr.leaderstats.Money.Value >= Money.Price.Value then
- plr.leaderstats.Money.Value = plr.leaderstats.Money.Value - Money.Price.Value
- local newMoney = Money:Clone()
- local oldMoney = plr.Backpack:FindFirstChildOfClass("Tool") or plr.Character:FindFirstChildOfClass("Tool")
- oldMoney:Destroy()
- newMoney.Parent = plr.Backpack
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement