Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Gamepass Surface GUI Not Working?

Asked by 9 years ago

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!

3 answers

Log in to vote
0
Answered by 9 years ago

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

0
Nope LittleBigDeveloper 245 — 9y
0
you're gonna need an adornee unmiss 337 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

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"

Log in to vote
0
Answered by 7 years ago

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

Answer this question