Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 3 years ago

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

1
what Xapelize 2658 — 3y

1 answer

Log in to vote
1
Answered by
Xapelize 2658 Moderation Voter Community Moderator
3 years ago

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!

0
Thanks youuuuuuuiiii 44 — 3y
Ad

Answer this question