Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

PromptPurchase script not giving player a PromptPurchase?

Asked by
danglt 185
6 years ago
local button = script.Parent
local devid = 441671993

button.MouseButton1Click:Connect(function(player)
    game:GetService("MarketplaceService"):PromptPurchase(player, devid)
end)
0
If it's a gamepass, use PromptGamePassPurchase. If it's a dev product, use PromptProductPurchase Rare_tendo 3000 — 6y
0
i was using that before, thats weird danglt 185 — 6y
2
The MouseButton1Click event has no parameters, so “player” would return nil. Fortunately, you can use game.Players.LocalPlayer instead to get the player, assuming you’re using a local script. User#20279 0 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

Your script should have "PromptGamepassPurchase" or "PromptProductPurchase" depending on if it is a gamepass or a dev product. Here is your fixed script: Gamepass script:

local button = script.Parent
local devid = 441671993

button.MouseButton1Click:Connect(function(player)
    game:GetService("MarketplaceService"):PromptGamePassPurchase(player, devid)
end)

Dev Product:

local button = script.Parent
local devid = 441671993

button.MouseButton1Click:Connect(function(player)
    game:GetService("MarketplaceService"):PromptProductPurchase(player, devid)
end)

Accept this answer if it helped you!

0
it does work accept it WideSteal321 773 — 6y
Ad

Answer this question