Why won't this script prompt a game pass purchase?

script.Parent.Parent.ClickDetector.MouseClick:Connect(function(Player)

game:GetService("MarketplaceService"):PromptGamePassPurchase(Player, 11261938)

end)

It does nothing, and returns nothing in the output section. How do I fix this?

2 Likes

Is this is a local or server script. For market place service, you need to use a local script to prompt the game pass purchase (I think).

1 Like

This script should work. The first parameter used in the ClickDetector.MouseClick event is the player who clicked it, therefore prompting the purchase to the player who clicked it should work properly. I have tested this exact script in my own game and it worked as expected.

Here’s a few things to help you find what’s wrong:

  • Check that you are referencing correctly to the ClickDetector. It’s possible that you’re referencing to the wrong place in the first line.
  • Check that the gamepass ID is correct. If this gamepass is not a gamepass which is stored in the place, you will have to enable third party purchases in game settings in order for it to prompt the purchase.
1 Like

It’s a local script. I tried testing if the surface gui over it was bothering the click but it wasn’t.

The gamepass ID is correct, and it is referring to the click detector. And third party purchases are enabled

Ah, it’s because you’ve got this in a LocalScript then. Test the exact same code in a normal script and it should work.

2 Likes

Got it. Thank you, if it doesn’t work make sure to stay tuned.

It does not do anything, still no error.

Nevermind! It was just lag, TYSM!!