Purchase Failed when attempting to purchase a Gamepass

I’m trying to make an in-game shop GUI which let’s the user purchase gamepasses. However everytime I click on the “purchase” button to get the purchase prompt for the gamepass, I get this image.

(Image)

I have all of the gamepasses set to “active”

(Links to gamepasses on Website)

Pass 1: VIP - Roblox
Pass 2: Speed Coil - Roblox
Pass 3: Gravity Coil - Roblox
Pass 4: Fusion Coil - Roblox

.

And here's an example of the code within the button
script.Parent.MouseButton1Down:Connect(function()
	local marketPlaceService = game:GetService("MarketplaceService")
	marketPlaceService:PromptProductPurchase(game.Players.LocalPlayer, 265701706)
	
	local Click = Instance.new ("Sound")
	Click.Parent = script
	Click.SoundId = 421058925
	Click:Play()
	wait(1)
	Click:Destroy()
end)

local button = script.Parent
local originalSize = button.Size

local originalPosition = button.Position

local scaleFactor = 1.05

local function onMouseEnter()
	local newOffsetX = originalPosition.X.Offset - (originalSize.X.Offset * (scaleFactor - 1) / 2)
	local newOffsetY = originalPosition.Y.Offset - (originalSize.Y.Offset * (scaleFactor - 1) / 2)

	button.Size = UDim2.new(originalSize.X.Scale * scaleFactor, originalSize.X.Offset * scaleFactor, originalSize.Y.Scale * scaleFactor, originalSize.Y.Offset * scaleFactor)

	button.Position = UDim2.new(originalPosition.X.Scale, newOffsetX, originalPosition.Y.Scale, newOffsetY)
end

local function onMouseLeave()
	button.Size = UDim2.new(originalSize.X.Scale, 0, originalSize.Y.Scale, 0)
	button.Position = UDim2.new(originalPosition.X.Scale, 0, originalPosition.Y.Scale, 0)
end

button.MouseEnter:Connect(onMouseEnter)
button.MouseLeave:Connect(onMouseLeave)

What can I do to make it so the passes get prompted when the player clicks the prompt prompter?

If this is in Roblox studio, I’m pretty sure you can’t make purchases from Studio… so try testing in-game. Also, make sure the game settings allow third-party purchases

2 Likes

I turned on the third-party purchases and tested it in studio: Didn’t work

I also tested it in game and I got the same prompt

did you get any errors in the console?

1 Like

You cant prompt purchases from the client, you need to use a remote event to prompt it from the server

1 Like

I made a script which prompts the purchase from a part (using a server script) and it gives the same popup

This is (one of) the server scripts
local part = script.Parent
local productId = 265700950

local function onTouch(hit)
	local character = hit.Parent
	local player = game.Players:GetPlayerFromCharacter(character)

	if player then
		game:GetService("MarketplaceService"):PromptPurchase(player, productId)
	end
end

part.Touched:Connect(onTouch)

It also lets me prompt product purchases from the GUI (local script) for the client

The console gave no errors related to the gamepass

Roblox allows you to purchase things in Studio, benefit being that it does not charge you for any purchase made there for convenience and testing.

1 Like