local button = script.Parent.Purchase
local mpService = game:getService("MarketplaceService")
button.MouseButton1Click:connect(function()
mpService:PromptProductPurchase(game.Players.LocalPlayer, 335171701)
end)
This script is a localscript inside of a text button that is the child of a screenGUI.

1 comment
are you sure the
buttonvariable is referencing the correct button? If your comment on the bottom of the question is right thenbuttonis referencing the childPurchaseof the button the script is a child of