Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I set up a Surface Gui that prompts a purchase for a Roblox Product?

I've looked around and couldn't find anything so far. If someone could help me write the script for it that would be awesome!

4 comments

0

U write the script for it

0

make a screengui and put a SurfaceGui inside it as set the adornee to the part, and put a textbutton in it

0

then just listen for when the user clicks the button and do the stuff

0

omg this freaking question has "request" written all over it

1 answer

-- Server
local MarketPlaceService = game:GetService("MarketplaceService")

MarketPlaceService.ProcessReceipt = function(receiptInfo)
       local userId = receiptInfo.PlayerId


       if receiptInfo.ProductId == 0000 then -- 100 Cash Id
               local Player = game.players:GetPlayerFromUserIdAsync(userId)
               local Cash = Player.leaderstats.Cash

               Cash.Value = Cash.Value + 100
       end
end
-- Client
local Player = game.Players.LocalPlayer
local ProductId = 0000
local MarketPlaceService = game:GetService("MarketplaceService")
local Button  = script.Parent.Button

Button.MouseButton1Click:Connect(function()
    MarketPlaceService:PromptPurchase(ProductId)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.