local bloxyColaId = 109367940
script.Parent.ClickDetector.MouseClick:connect(function(player)
Game:GetService("MarketplaceService"):PromptPurchase(player, bloxyColaId, false, 2)
end)
The code I have above worked fine for a clickdetector in a normal block. But after I moves it to a gui, I changed it around to this:
local assetId = script.Parent.MarketID
script.Parent.MouseButton1Down(function(player)
Game:GetService("MarketplaceService"):PromptPurchase(player, assetId, false, 2)
end)
So all I basically did was make the asset id a string value and the script inside of a gui. Does MarketplaceService not like string values? Please help Responds to this would really be helpful.

3 comments
I tried this in my script. But it does not work out. The output says that on line 3 there is an error and the error says "Unable to cast value to Object." Can you please help me resolve this issue?
Looks like you've also forgotten to define "player" ! I'll update this message in a second
I tried it out. It still does not work.