Hello, I just finished my first commission and they chose to pay with gamepass method. So I created this script which asks the person if they want to pay 100 robux. I want the script to also check if the payment is successful and change the text to “Successfully payed”
This is the script:
local player = game.Players.LocalPlayer
local PayCommissionId = "Can't share, sorry"
script.Parent.MouseButton1Click:Connect(function()
game.MarketplaceService:PromptProductPurchase(player, PayCommissionId)
end)
If the ID is needed really then I can share it
local function Purchased(plr, ID, success)
if success then
--If successful
else
--If not succesfull
end
end
MarketplaceService.PromptGamePassPurchaseFinished:Connect(gamepassPurchaseFinished)
This code needs to be a server script. In order to communicate with the GUI you need to use Remote Events
So should I type this [MarketplaceService.PromptPurchaseFinished]
local player = game.Players.LocalPlayer
local PayCommissionId = "Can't share, sorry"
script.Parent.MouseButton1Click:Connect(function()
game.MarketplaceService:PromptProductPurchase(player, PayCommissionId)
end)
if MarketplaceService.PromptPurchaseFinished = true then
script.Parent.Text = "Successfully payed"
Is it how you do it?
Actually I am not clear with this gamepass things and stuff