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

Can i please have help about the game pass?

There is an output error when i'm trying make it but it wont work. The script is:

script.Parent.MouseButton1Click:Connect(function()
game:GetService("MarketplaceService"):PromptPurchase(4862753)
end)

2 answers

✓ Accepted answer

So if you want to use the gamepassGui there is the localscript:

function Click()
local players = game.Players.LocalPlayer
local id = 4862753
game:GetService("MarketplaceService"):PromptGamePassPurchase(players, id)
end

script.Parent.MouseButton1Click:Connect(Click)

1 comment

0

Thank you!

First of all, you should be using PromptGamePassPurchase because it's a gamepass. Here!

As you can see, the first argument is UserID. To get that userId, use LocalPlayer. The second argument is the gamepass id

Here's your script fixed:

local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
	game:GetService("MarketplaceService"):PromptGamePassPurchase(player.UserId,ID)
end)
--Put the gamepass id where it says "ID"

Be sure to use the correct one!

3 comments

0

I need the gamepassgui

0

oh one second

0

It cut off the gamepass id for whatever reason, but make sure you just put the gamepass id as the second argument

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