Ok so I have a screen GUI and a text button in it and this is the script I put in the text button:
1 | local adminId = 217525614 |
2 | script.Parent.MouseButton 1 Down:connect( function (player) |
3 | Game:GetService( "MarketplaceService" ):PromptPurchase(player, adminId) |
4 | end ) |
The problem is the "player" in the MouseButton1Down
function. Because there are no parameters for MouseButton1Down
. MouseButton1Click
is actually better to use unless you want them to hold the mouse down. This is a local script. This should work.
1 | local adminId = 217525614 |
2 | script.Parent.MouseButton 1 Down:connect( function () |
3 | local player = game.Players.LocalPlayer --You can use localplayer only in local scripts. |
4 | game:GetService( "MarketplaceService" ):PromptProductPurchase(player, adminId) |
5 | end ) |
This script used: LocalPlayer, PromptProductPurchase and MouseButton1Click
Put this in
local cleanSweepId = 158439152 -- Your Game pass id here! (Made by Animine)
script.Parent.ClickDetector.MouseClick:connect(function(player) Game:GetService("MarketplaceService"):PromptPurchase(player, cleanSweepId) end)
Closed as Too Broad by DataStore, EzraNehemiah_TF2, and Shawnyg
This question has been closed because it is too broad and is generally unanswerable. Please ask a more specific question.
Why was this question closed?