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

How do i prompt a developer product?

local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
button = script.Parent
buttopn.MouseButton1Click:Connect(function()
 
local productID = 335171701  

local function promptPurchase()
	local player = Players.LocalPlayer
	MarketplaceService:PromptProductPurchase(player, productID)
end

The code doesn't pull up the buy button, then I have a receipt handler in server script service.

1 answer

Hello, VirtualPugtato!

You had forgot to call the function promptPurchase()

Corrected script:

local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
button = script.Parent
buttopn.MouseButton1Click:Connect(function()

	local productID = 335171701  

	local function promptPurchase()
		local player = Players.LocalPlayer
		MarketplaceService:PromptProductPurchase(player, productID)
	end

	promptPurchase()
end

2 comments

1

um, you cant call a function before it is declared

0

that's right *

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