Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rs = game.ReplicatedStorage
- local buyItem = rs.BuyItem
- local items = game.ServerStorage.Items
- local itemsInfo = game.ServerStorage.ItemsInfo
- buyItem.OnServerEvent:Connect(function(plr, itemName)
- local item = items:FindFirstChild(itemName)
- local price = itemsInfo:FindFirstChild(itemName).Value
- local plrMoney = plr:FindFirstChild("leaderstats"):FindFirstChild("Money")
- if plrMoney.Value - price >= 0 then
- plrMoney.Value -= price
- local newItem = item:Clone()
- newItem.Parent = plr.Backpack
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement