Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Gamepass button script doesn’t work and I forgot the script ?????

????????????the script of GAMEPASS BUTTON didn’t work. Script in it will be added it 2-5 hours????????????

1 comment

1

what

1 answer

✓ Accepted answer

Use a LocalScript

If the Game passes were Developer Product, use :PromptProductPurchase, but if it's a Game pass, use :PromptGamePassPurchase. Do not use the others because it's not really recommended.

You might need to use a LocalScript for this, so it doesn't call everyone and send the prompt; so it only access the client.

So you need to use 2 parameters, first is the UserId, and the GamePassId / ProductId. So it's pretty easy to get the GamePassId / ProductId. If you don't know how, there's a more clear explanation on the website! But about UserId, you can do:

-- This is a LocalScript.

local Player = game.Players.LocalPlayer

print(Player.UserId) -- Prints the UserId

About how to use :PromptGamePassPurchase...

-- This is a LocalScript

local PlayerId = game.Players.LocalPlayer.UserId
local GamePassId = 1234567890

game:GetService("MarketplaceService"):PromptGamePassPurchase(PlayerId, GamePassId)

If it's a developer product, just replace :PromptGamePassPurchase to PromptProductPurchase! They work the same, but different type of game passes.

If you have any question you can ask me below, I'll be glad to help you!

1 comment

0

Thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.