Why won't my purchase game pass prompts work?

I made a gui store, but the prompts to purchase the game passes aren’t working. Here’s my script:

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

local MarketplaceService = game:GetService("MarketplaceService")

local frame = script.Parent
local buy =frame.TextButton

buy.MouseButton1Click:Connect(function()
	MarketplaceService:PromptGamePassPurchase(localPlayer, 2774205361)
end)

This is a local script inside of a frame, inside of another frame, inside of a screen GUI, inside of Starter GUI. When I try to purchase it, a prompt shows up on my screen saying, “Your purchase failed because something went wrong. Your account has not been charged. Please try again later.”
I don’t know if the issue is with my script or the location of the script, but I don’t know how to fix it. How do I fix this?

2 Likes

possibly your id is incorrect? if not then is third party sales enabled?
if the prompt is working then it isnt the code, since it for sure is trying to make you buy the gamepass

Hmm. I think I’ll check to make sure the ids are correct.

I think you need player.UserId. also check to see if the game pass is for sale, and that the id is valid.

1 Like

Yep, I somehow used the experience id instead of the gamepass id :skull:

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