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

I need a script that can help me click a button then my developer product pops up on the screen?

-- I have a button already but i need the script that makes it so that when i click the button it allows me to buy the developer product

1 answer

If it's a ClickDetector...

id = 1337 -- Dev product Id
cd = script.Parent.ClickDetector

cd.MouseClick:connect(function(p)
	game:GetService("MarketplaceService"):PromptProductPurchase(p, id)
end)

If it's a TextButton on a GUI (Not Surface)

--Local script
id = 1337
sp = script.Parent
p = game.Players.LocalPlayer

sp.MouseButton1Down:connect(function()
	game:GetService("MarketplaceService"):PromptProductPurchase(p, id)
end)

-- If you want it in a regular script:

id = 1337
sp = script.Parent
p = script.Parent.Parent --Should lead to the Parent of StarterGui, which is game.Archivable

sp.MouseButton1Down:connect(function()
	game:GetService("MarketplaceService"):PromptProductPurchase(p, id)
end)

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