I am a developer in ROBLOX Science Inc., and I am adding a gamepass GUI button. The script does not work, and when I click it, it gives me “Argument 2 missing or nil”, and links Line 4.
Script:
local gamepass id = 10692403
script.Parent.MouseButton1Click:Connect(function()
game:GetService(“MarketplaceService”):PromptGamePassPurchase(game.Players.LocalPlayer, gamepass)
end)
You didn’t use your gamePassID variable correctly. Take another look at your code. You defined the ID as “gamepass id” but you wrote “gamepass” when prompting the purchase.
Hope this helps! ![]()
Building off of what @dodle120 said, just replace your current script with this one:
local gamepassid = 10692403
script.Parent.MouseButton1Click:Connect(function()
game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer,gamepassid)
end)
1 Like
This is For Gamepasses if you will need after TO make Product Buttons i made
Gui for that