My pay to open gui script is not working

Hello, my pay to open Gui script is not working, here are my scripts, one local and the other server. It works like this a devproduct is prompted to be purchased when someone clicks a Gui button, and when you complete a purchase, it does not open the gui, here are my scripts: (on the server one I did’t know what to put after, that’s probably where my mistakes came in)

> Local: local mps = game:GetService("MarketplaceService")
> local plr = game.Players.LocalPlayer
> local id = 1178903400
> local FeedbackMain = script.Parent.Parent.FeedbackMain
> script.Parent.MouseButton1Click:Connect(function()
> 	mps:PromptProductPurchase(plr, id)
> 	end)

Server:

local mps = game:GetService("MarketplaceService")
mps.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == 1178903400 then
		local Player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		
	end
end

Could be a few things:

1- marketplaceService.ProcessReceipt expects a ProductPurchaseDecision enum to be returned.
2- You aren’t ever telling the client to open the UI. This is probably best done by a remote event:

local mps = game:GetService("MarketplaceService")
local replicatedStorage = game:GetService('ReplicatedStorage')
local myRemoteEvent = replicatedStorage.RemoteEvent
mps.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == 1178903400 then
		local Player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		remoteEvent:FireClient(player)
        return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end

Then on the client,

local mps = game:GetService("MarketplaceService")
local replicatedStorage = game:GetService('ReplicatedStorage')
local myRemoteEvent = replicatedStorage.RemoteEvent
local myUI = script.Parent.ScreenGui.Frame
myRemoteEvent.OnClientEvent:Connect(function()
    myUI.Visible = true
end)
1 Like