local assetId = script.Parent.MarketID.Value
script.Parent.MouseButton1Down:connect(function()
Game:GetService("MarketplaceService"):PromptPurchase(game.Players.LocalPlayer, assetId, false, 2)
end)

I tried the above code inside of a local script and it still does not work. Also the following code is pasted inside of a gui. Please help.