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?
1 | function onClicked() |
2 | local player = game.Players.LocalPlayer |
3 | game:GetService( "MarketplaceService" ):PromptGamePassPurchase(player, id) -- id is the id of the gamepass |
4 | end |
5 | 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!
1 | script.Parent.ClickDetector.MouseClick:Connect( function (player) |
2 | game:GetService( "MarketplaceService" ):PromptGamePassPurchase(player, 00000000 ) -- id of your gamepass |
3 | end ) |