Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local items = game.ReplicatedStorage:WaitForChild("Items")
- game.Players.PlayerAdded:Connect(function(plr)
- local ls = Instance.new("Folder")
- ls.Name = "leaderstats"
- ls.Parent = plr
- local cash = Instance.new("IntValue")
- cash.Name = "Cash"
- cash.Value = 1000
- cash.Parent = ls
- end)
- game.ReplicatedStorage:WaitForChild("OnItemBought").OnServerEvent:Connect(function(plr, itemBought)
- if itemBought and itemBought:IsA("Tool") and itemBought.Parent == items then
- local cash = plr.leaderstats.Cash
- if cash.Value >= itemBought.ShopGuiInfo.Price.Value then
- cash.Value -= itemBought.ShopGuiInfo.Price.Value
- itemBought:Clone().Parent = plr.Backpack
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement