-- 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
COMMUNITY QUESTION
I need a script that can help me click a button then my developer product pops up on the screen?
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.
