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

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

Asked by 6 years ago

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!

0
U write the script for it User#23365 30 — 6y
0
make a screengui and put a SurfaceGui inside it as set the adornee to the part, and put a textbutton in it User#23365 30 — 6y
0
then just listen for when the user clicks the button and do the stuff User#23365 30 — 6y
0
omg this freaking question has "request" written all over it DeceptiveCaster 3761 — 6y

1 answer

Log in to vote
0
Answered by
Shadrz 40
6 years ago
-- 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)
Ad

Answer this question