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

How to make a brick that prompts a gamepass when you click it?

Asked by 4 years ago
Edited 4 years ago

When I advertise my game, I want to make money. So, I want to make a brick that when you click it, it prompts a gamepass. How do I do that?

2 answers

Log in to vote
0
Answered by 4 years ago
function onClicked()
    local player = game.Players.LocalPlayer
    game:GetService("MarketplaceService"):PromptGamePassPurchase(player, id) -- id is the id of the gamepass
end
script.Parent.ClickDetector.MouseClick:Connect(onClicked)

Should work, but put the script in the part, and have a ClickDetector in the part aswell. Hope it helps!

0
this doesn't work because a server script cannot access LocalPlayer kkfilms_1 68 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
script.Parent.ClickDetector.MouseClick:Connect(function(player)
    game:GetService("MarketplaceService"):PromptGamePassPurchase(player, 00000000) -- id of your gamepass
end)

Answer this question