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

i don't know the script to make a purchase button?

karlo_tr10 gave me a code to increase players currency which will work with the purchase button script for Dev product. Is there a purchase script to trigger a purchase?

1 comment

1

Did the solution not work?

1 answer

✓ Accepted answer

You can prompt a purchase for players to purchase a gamepass or some other dev product, but you cannot force someone to purchase a the product. That is up to them.

Although, if you want to bring up the purchase prompt and don't know how, this is how you'd do that:

-- *****This code should be within a 'LocalScript' object****
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
 
local productID = 0000000  -- Change this to your developer product ID
 
-- Function to prompt purchase of the developer product
local function promptPurchase()
	local player = Players.LocalPlayer
	MarketplaceService:PromptProductPurchase(player, productID)
end


--function for when the player clicks a button goes here....
	promptPurchase()
--end of button click function

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