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

Why is it saying Argument 2 missing or nil?

script.Parent.ClickDetector.MouseClick:Connect(function()
	game:GetService("MarketplaceService"):PromptPurchase(438478073)
end)

1 answer

✓ Accepted answer

The PromptPurchace function requires a Client argument to fire it to also two more. I suggest PromptGamePassPurchase. If you'd like to run to all Clients, write your code in a for loop with the example below, but this should fix your code

script.Parent.ClickDetector.MouseClick:Connect(function(Player) --// ClickDetectors have an argument that passes the Player who clicked
    game:GetService("MarketplaceService"):PromptGamePassPurchase(Player, 438478073, )
end)

For All Clients

script.Parent.ClickDetector.MouseClick:Connect(function()
    for _,Player in ipairs(game.Players:GetPlayers()) do
       game:GetService("MarketplaceService"):PromptGamePassPurchase(Player, 438478073)
   end
end)

PromptPurchase requires the Client to fire to, the asset Id, equip on purchase, and currency type

2 comments

0

why? he didn't say he wanted to prompt a game pass purchase

0

I know, that's why I put the list of arguments required by PromptPurchase, in case he wasn't looking to sell

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