Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local shopFrame = script.Parent
- local gui = shopFrame.Parent
- local button = gui.ShopButton
- local itemList = shopFrame:WaitForChild("ItemList")
- local preset = itemList:WaitForChild("Preset")
- local marketplaceService = game:GetService("MarketplaceService")
- local replicatedStorage = game:GetService("ReplicatedStorage")
- local products = replicatedStorage:WaitForChild("Products")
- local remote = replicatedStorage:WaitForChild("PurchaseProduct")
- function purchase(assetId)
- remote:FireServer(assetId)
- end
- for i,product in products:GetChildren() do
- local info = marketplaceService:GetProductInfo(product.Value,Enum.InfoType.Product)
- if info then
- local price = info.PriceInRobux
- local name = info.Name
- local isForSale = info.IsForSale
- local image = info.IconImageAssetId
- if isForSale then
- local newPreset = preset:Clone()
- newPreset.Visible = true
- newPreset.Product.Price.Text = "R$"..price
- newPreset.Product.ItemName.Text = name
- newPreset.Product.Icon.Image = "rbxassetid://"..image
- newPreset.Name = name
- newPreset.Parent = itemList
- newPreset.Product.Purchase.MouseButton1Down:Connect(function()
- purchase(product.Value)
- end)
- end
- end
- end
- button.MouseButton1Down:Connect(function()
- shopFrame.Visible = not shopFrame.Visible
- end)
Advertisement
Add Comment
Please, Sign In to add comment