Gamepass prompt not working!

I don’t know if there is a promblem in this script? Can someone help?
https://gyazo.com/6f067f6b23c15bf20b28ab6ec7c0f001

1 Like

Is the script in the UI? I’m not exactly sure what to do.

script.Parent.MouseButton1Click:Connect(function()
    (MarketPlaceService:PromptGamePassPurchase(plr.UserId, 0)) --Change 0 with the id of your gamepass
end)

Could you send a screenshot of where your script is in your explorer. That could help the community to help you with your problem.

PromptGamePassPurchase does not work with Userids, only player instances

To @ReaperBlizz, where is the script located? Show us the explorer, as I don’t see anything that coudl be a problem unless you gave a wrong id

1 Like

here is the explorer gyza
https://gyazo.com/ea5c96e3697ea5676ae3b47c3b8e5fc5

Which localscript is the one you’ve shown? The one in the ImageButton in the ScreenGui called ScreenGui? If so, it’s likely a wrong id?

Its the “shop” one, in the starter UI

It is not the id that went wrong.

I’m unsure if this will change anything, but maybe try this?

local plr = game:GetService("Players").LocalPlayer
local button = script.Parent
local mps = game:GetService("MarketPlaceService")

local gamepassId = 16198696

button.MouseButton1Click:Connect(function()
	mps:PromptGamePassPurchase(plr, gamepassId)
    print("Prompted")
end)

Nope, still doesn’t work. I tried but nothing,

Did it at least print Prompted? If so, it’s likely the id is incorrect, double check if

This should work:

local mps = game:GetService("MarketplaceService")

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
    mps:PromptGamePassPurchase(player, 16198696)
end)

That’s literally almost the same thing as what I and @OP did, it’s not an issue with the code, it’s an issue with the ID most likely,

That does the exact same thing as @EmbatTheHybrid’s script, except you didn’t define the player and button.

1 Like

Ok, we must probably know if he’s getting the third party item sales error or if he is using an incorrect id.

The gamepass ID works, but no prompt!

Did you enable Third party sales from the Game settings? You need it enabled if it’s disabled

Yes, this is what I was saying.

Thanks! That was the issue.
Lets see if it works!
https://www.roblox.com/games/6571903958/Blizzards-difficulty-chart-obby#!/store

1 Like