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

I asked how to get a button were if you click it it shows a buy popup?

I got a codeing thing so if any of you guys can help me add me on discord so you you can do it i REALY need help discord ThinksushYT#7641

the code is

"local id = 16630147--change it to your own id local textbutton = --locate it here by your own local plr = game.Players.LocalPlayer --locating the local player

textbutton.MouseButton1Click:Connect(function()--an event which occurs when the player clicks the button game:GetService("MarketplaceService"):PromptPurchase(plr, id) --popping up a prompt purchase end)" Plz help

1 answer

If you want it to prompt a game pass purchase, use PromptGamePassPurchase instead of PromptPurchase. Then, the first argument will be the player, and the second will be the game pass ID.

textbutton.MouseButton1Click:Connect(function()

	-- this is what you have
	game:GetService("MarketplaceService"):PromptPurchase(plr, id)

	-- change it to this
	game:GetService("MarketplaceService"):PromptGamePassPurchase(plr, id)

Hope this helps! :)

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