????????????the script of GAMEPASS BUTTON didn’t work. Script in it will be added it 2-5 hours????????????
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!