Ask For A Pass Task

I want to be able for a player to buy a pass in- game. I’ve tried stuff like using the scripts for dev products but it hasn’t worked. I just want to prompt the gamepass once a player clicks on a ui
Script I’ve Tried:
ServerScript:```lua
local MarketPlace = game:GetService(“MarketplaceService”)

MarketPlace.ProcessReceipt = function(receiptInfo)

if receiptInfo.ProductId == 13664788 then
	local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
	
	print("BoughtPass")

	return Enum.ProductPurchaseDecision.PurchaseGranted

end

end

ButtonScript:
```lua
local id = 13664788
local mps = game:GetService("MarketplaceService")
local plr = game.Players.LocalPlayer


script.Parent.MouseButton1Click:Connect(function()
	mps:PromptProductPurchase(plr, id)
end)```

Are you trying to prompt the player a gamepass or a product

Any errors or add print statements? Also you can use PromptGamePassPurchase I think if you haven’t tried that

i think i figured it out. It was alot easier than I thought lol.

If you are trying to prompt the player to purchase a Game Pass, you should use :PromptGamePassPurchase. If you do switch to that method, though, you would need to use the :PromptGamePassPurchaseFinished event.

Yeah I just figured that out. I was doing way too much for way too little honestly.

1 Like