Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I use dev products efficiently?

Asked by 10 years ago

I was easily able to sell one product through a gui, but how do I do multiples? Assuming that the hierarchy is correct, what would the problem be here?

local p = game.Players.LocalPlayer
--game:GetService("MarketplaceService"):PromptProductPurchase(p, productId)
local sf = script.Parent.ScrollingFrame
local sfl = script.Parent.Frame
local mps = game:GetService("MarketplaceService")

local function buyItem(button, tokenz, marketId)
    button.MouseButton1Click:connect(function()
        Instance.new("Part", Workspace)
        link:PromptProductPurchase(p.userId,marketId) 
        link.ProcessReceipt = function(receiptInfo)
            if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then
                p.leaderstats.Tokenz.Value = p.leaderstats.Tokenz.Value + tokenz
            end
        end
    end)
end



buyItem(sfl["Tokz5"].Button, 5, 20264294)
buyItem(sfl["Tokz10"].Button, 10, 20264295)
buyItem(sfl["Tokz15"].Button, 15, 20264302)
buyItem(sfl["Tokz20"].Button, 20, 20264304)
butItem(sfl["Tokz25"].Button, 25, 20264308)
buyItem(sfl["Tokz50"].Button, 50, 20264312)
buyItem(sfl["Tokz100"].Button, 100, 20264313)
buyItem(sfl["Tokz250"].Button, 250, 20264315)
buyItem(sfl["Tokz500"].Button, 500, 20264318)
buyItem(sfl["Tokz1000"].Button, 1000, 20264321)

P.S- There are no errors in the output or online.

Answer this question