Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why PromptProductPurchase Isn't working?

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

2 comments

0

what was the in the output when you ran this?

0

nothing

1 answer

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

3 comments

0

thats pretty much the same thing, though you can call the function multiple times

0

idk i'm using that method i don't call this function many times

0

You dont know scripting. I am sure.

This discussion is preserved as it was. New answers, comments, and votes are closed.