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

Why PromptProductPurchase Isn't working?

Asked by 5 years ago

Hello, I made an product script for an donate gui, I tried to buy my product but there was an error. What is the error in my script? I think i am true but,

local Player = game:GetService("Players").LocalPlayer
local MarketplaceService = game:GetService("MarketplaceService")

for _, thing in pairs(script.Parent:GetChildren()) do
    if thing.ClassName == "TextButton" then
        thing.MouseButton1Click:Connect(function()
            MarketplaceService:PromptProductPurchase(Player, thing.ID.Value)
        end)
    end
end
0
what was the in the output when you ran this? EliteRayGawnX2 124 — 5y
0
nothing FrezeTagger 75 — 5y

1 answer

Log in to vote
0
Answered by
Diltz_3 75
5 years ago

Try to make pairs in a function That helps me

local Player = game:GetService("Players").LocalPlayer
local MarketplaceService = game:GetService("MarketplaceService")

function press_btn() -- Creates a function
    for _, thing in pairs(script.Parent:GetChildren()) do
        if thing.ClassName == "TextButton" then
            thing.MouseButton1Click:Connect(function()
                MarketplaceService:PromptProductPurchase(Player, thing.ID.Value)
            end)
        end
    end
end

press_btn() -- Starts a function
0
thats pretty much the same thing, though you can call the function multiple times User#23365 30 — 5y
0
idk i'm using that method i don't call this function many times Diltz_3 75 — 5y
0
You dont know scripting. I am sure. FrezeTagger 75 — 5y
Ad

Answer this question