So ive got a surface gui with a textbutton. In that textbutton there is a local script with this script:
local gamepass = 254533582 local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() game:GetService("MarketplaceService"):PromptPurchase(player, gamepass) end)
When i click it, nothing happens and i dont know why!
Did you put it into a localscript
? If you did, try this:
-make sure it's a textButton
-or insert the following:
local player=game.Players.LocalPlayer local gamepassId=254533582 function Click() Game:GetService("MarketplaceService"):PromptPurchase(player, gamepassId) end script.Parent.MouseButton1Click:connect(Click)
If this doesn't work, I'm clueless. I'm not very familiar with MarketPlaceService.
Hope this helped!
-ds
Is there any output? Make sure you are using the right command, there is a difference in between PromtPurchase, and PromtProductPurchase(), PromptPurchase is for developer products, while PromtProductPurchase() is for roblox-made products(catalog items)
Let me know if this works, if not I can try help you with other stuff, I have made my own market place stuff before, by the way, it may not work in studio mode, you will see something pop up in output about that if so, itll say something like "can't use this API in play solo mode"
This LocalScript will only work if an adornee was set. Try putting the SurfaceGui in the StarterGui, insert a script inside of the SurfaceGui, and then, put this:
script.Parent.Adornee = game.Workspace.Part -- Change to the old destination of the surfacegui or whatever