"Your purchase failed because something went wrong"

I’m trying to make a mini in-game gamepass shop however every time the player attempts to purchase a game pass (whether from touching a physical purchase prompt block in game or through the shop gui) the message “This item is currently not for sale” pops up.
.

📜 Here's the localscript:
script.Parent.MouseButton1Down:Connect(function()
	local marketPlaceService = game:GetService("MarketplaceService")
	marketPlaceService:PromptProductPurchase(game.Players.LocalPlayer, 265700950)
	
	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 GUI shop works?

Links to the gamepasses (if necessary)

Speed Coil - Roblox
Gravity Coil - Roblox
Fusion Coil - Roblox
Rainbow Flying Magic Carpet - Roblox

1 Like

“This item is currently not for sale” This is not a script error at all though , you cannot code something that is related to price , you gotta edit ur item from the roblox website , not a script error.

Hi there! This is quite an easy fix.

The reason this didn’t work is because you’re using :PromptProductPurchase() which prompts the player to purchase a developer product instead of a gamepass.

Simply replace:

marketPlaceService:PromptProductPurchase(game.Players.LocalPlayer, 265700950)

With:

marketPlaceService:PromptGamePassPurchase(game.Players.LocalPlayer, 265700950)
5 Likes

Yeah that was it, accidentally left them as PromptProductPurchase, good eye!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.