How to prompt a purchase?

Hello. I have a game in development. I have nearly finished the rough layout of the GUIS and I have started scripting them. One of them is a Robux section.


When I run the game and try buy any item this shows up image The wierd thing is that the item is on sale VIP - Roblox Can anyone help me with what is wrong. This the script I have:

local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
	print("Promting Purchase!")
	wait(0)
	game:GetService("MarketplaceService"):PromptPurchase(game.Players.LocalPlayer, 14713223)
	print("Purchase Prompted!")

end)
1 Like

Your assetId is a gamepass, you should use PromptGamePassPurchase instead

3 Likes

I think you have to use a dev product in order to prompt it.

It dosn’t work with the developer product either. I have tried.

2 Likes

That worked for the gamepass. But how do I make the developer product work?

try this

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

MarketplaceService:PromptProductPurchase (roblox.com)

1 Like

try this

local MarketplaceService = game:GetService("MarketplaceService")
local productID = 0000000 -- Change this to your developer product ID
local player = game.Players.LocalPlayer
MarketplaceService:PromptProductPurchase(player, productID)
1 Like

I tried both but when I press buy image
it doesn’t show the prompt whereas the output image says the purchase was prompted.

Did you put in the dev product ID?

yes:

local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
	print("Promting Purchase!")
	wait(0)
	local productId = 14713352
	game.Players.PlayerAdded:Connect(function(player)
		Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
	end)
	print("Purchase Prompted!")

end)

Why do you have this:

game.Players.PlayerAdded:Connect(function(player)
end)

Surrounding your prompt purchase?

Because that’s what it said on there.

local productId = 14713352


script.Parent.MouseButton1Click:Connect(function()
	print("Prompting Purchase!")
	game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
	print("Purchase Prompted!")
end)
1 Like

That is if you wish the prompt to come up as soon as the player joins the game not through a button. You do not need it around the prompt purchase.

3 Likes

It should only show up when a button is pressed.

Yes do you do not need

game.Players.PlayerAdded:Connect(function(player)
end)

Surrounding it

image It doesn’t work it still says that it isn’t available.

Are you sure you are using the correct dev product ID?

1 Like

Ill make a new one and try that.

1 Like