MarketPlaceService Script Not Working ( your purchase failed )

--[[
	Written By CerealDude_Dev
--]]

--[Services & Variables ]

local MarketPlaceService = game:GetService("MarketplaceService")
local ID : number = 12866250753

--[ Client ]

local Players = game:GetService("Players")
local Client = Players.LocalPlayer

--[ Check If User Already Has Gamepass ]

local UserPrompt = function()
	local UserBought : boolean = false
	
	local Loaded, Errored = pcall(function()
		UserBought = MarketPlaceService:UserOwnsGamePassAsync(Client.UserId, ID)
	end)	
	
	if UserBought then return warn(Client.Name.." Has Already Bought Pass")else
		MarketPlaceService:PromptGamePassPurchase(Client, ID)	
	end
end

--[ Call Functions ]

script.Parent.Buy.MouseButton1Click:Connect(UserPrompt)

You either have already owned the item or you forgot to change the actual Gamepass ID (Unsure if its just for this post)

I don’t believe that is a gamepass ID that you are using.

Make sure you are going into your Creator Dashboard > Associated Items > click on the three dots when you hover over your gamepass > Copy Asset ID.

Such as what I have pictured below:

1 Like

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