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

How do I fix this script that sells shirts within a gui?

I made a gui that sells a shirt from my friends group in his game, but it doesn't actually work.

local id = 920808270

script.Parent.ImageButton.MouseButton1Click:connect(function()
	game.MarketplaceService:PromptProductPurchase(script.Parent.Parent.Parent, id)
end)

more details: the script and the imagebutton are both in a screen gui in the startergui

1 answer

✓ Accepted answer

Solution: Put this in a LocalScript inside of the ImageButton:

local id =  920808270
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
game:GetService("MarketplaceService"):PromptPurchase(player,id)
end)

I think your problem was that you used MouseButton1Click and you needed to add a variable that represented LocalPlayer, otherwise it would not prompt the purchase. If this helped, please upvote and accept my answer.

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