✓ Accepted answer
This is a bit tricky, considering the parent of the script, but the steps are fairly basic.
Step 1:
Move the entire SurfaceGui (not the brick, though) into StarterGui. Then, select the SurfaceGui, hold Ctrl, and select the brick it was in before. Without deselecting either item, type this in the command bar: local s=game.Selection:Get() s[1].Adornee=s[2]
This should allow the SurfaceGui to function from StarterGui.
Now for the main code. Type this in a regular script inside of the button.
local player=script.Parent.Parent.Parent.Parent
local id=0
function click()
game:GetService("MarketplaceService"):PromptPurchase(player,id)
end
script.Parent.MouseButton1Click:connect(click)
That should do it! Contact me with any questions.
9 comments
Thanks!
Now it doesn't work..
'PromptPurchase' does not work within a LocalScript; It is Server-Sided only sadly.
So, I should put it in a script?
You could, but, that will take a lot more editing of the code. :/
So, I have to edit it, or it won't work :/
Yep, pretty much. :/ You would have to edit the code so that it knows which target (the Player) is (As those repeatedly use the script.Parent.Parent until it reaches the Player).
Sad thing is, it's in a surfacegui
Helping him in ROBLOX PM's.