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

How do I make a GUI receipt become visible for a player after he/she bought my developer product?

I tried to make a GUI receipt visible for a player after that player bought our developer product. A script will active after that player clicked the buy button:

script.Parent.MouseButton1Click:Connect(function() game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, ID) end)

After that player bought our developer product, another script in ServerScriptService will active:

game:GetService("MarketplaceService").ProcessReceipt = function(receiptInfo) if receiptInfo.ProductId == (ID) then game.StarterGui.ScreenGui.Frame.GUI4.Product1.Price.Receipt.Visible = true return Enum.ProductPurchaseDecision.PurchaseGranted end end

The receipt is invisible before that player buying our developer product, and it will be visible after that player buying our developer product until he clicked the close button in the receipt, the close button script is:

script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Visible = false end)

I don't know why the system didn't work and I don't know how to fix it. I really hope that I can fix that problem, thank you!

3 comments

0

Put the code into code boxxes.

0

JUST MAKE THE CODE CORRECT (jk)

0

Please put it into a code box

1 answer

for the first script, do this (make sure it is a localscript):

script.Parent.MouseButton1Click:Connect(function()
	local MarketService = game:GetService("MarketplaceService")
	local ID = 69420 --replace 69420 with the id of the gamepass
	MarketService:PromptProductPurchase(game.Players.LocalPlayer,ID)
end)

for the second script, I don't really know how to solve. But what I do know is that:

  1. You aren't supposed to change the starterGui, you are supposed to change the LocalPlayer's PlayerGui. (you can't simply do "game.Players.LocalPlayer" on server scripts so I don't really know how to do this one)

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