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

How do i make a script which askes player for buying the gamepass on a gui?

i made a gui and checked some tutorials for making marketplacescervice on mousebutton1clicked on the gui but didnt work.

1 answer

To sell a gamepass you should use PromptGamePassPurchase for example

local marketplaceservice = game:GetService("MarketplaceService")
marketplaceservice.PromptGamePassPurchase(game.Players.playerusername,gamepassid)

Replace playerusername with the players username and replace gamepassid with the gamepass id, If you don't know what your ID is, go the gamepass, look at the url, for this example the url is https://www.roblox.com/game-pass/1057151/Excellent-Employee. Now look at the numbers inbetween in slash after the gamepass and slash before excellent, that is the gamepass ID. If this solved your answer be sure to hit the checkmark next to my answer and if you still need help feel free to reply to this question with it!

1 comment

1

If you want to make it a gui, so if you press the button, it prompts the purchase, then you would just change the first value of the PromptGamePassPurchase to game.Players.LocalPlayer (this would only work if the GUI was local)

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