why is promptpurchase prompting everyone in game? [SOLVED]
i am using promptproduct purchase for developer products i'm selling and promptpurchase for me gamepasses. i'm getting complaints from players about being prompted to purchase my game passes, but i don't have any auto-prompts running, only clickdetectors to prompt whoever clicks it. i've been selling developer products for awhile and haven't had complaints about being prompted, but i just added gamepasses to be purchased ingame and now i'm getting the complaints about being prompted to buy a pass, so i assume it's only doing this when a player clicks to purchase a gamepass, and not a developer product. the only difference between the two one uses promptproductpurchase and the other uses promptpurchase. i have the prompt script in a serverscript located inside player gui. this is what i'm doing, what dshould i do differently?
1 | buyButton.MouseClick:connect( function (player) |
2 | game:GetService( "MarketplaceService" ):PromptPurchase(player, productId) |
EDIT
here's the test place with a copy of the scripts.
I've moved the prompt script to a local script inside of playergui
here's my code
09 | local function showinfoproduct() |
10 | local store = script.Parent.store |
11 | local image = store.frame.frame.Thumbnail |
12 | local name = store.frame.frame.ItemName |
13 | local price = store.frame.frame.CurrencyAmount |
14 | local price 2 = store.frame.frame.CurrencyAmount 2 |
15 | local disc = store.frame.description |
16 | local asset = game:GetService( "MarketplaceService" ):GetProductInfo(assetid, Enum.InfoType.Product) |
17 | price.Text = asset.PriceInRobux |
18 | price 2. Text = asset.PriceInTickets |
19 | disc.Text = asset.Description |
21 | store.frame.Visible = true |
26 | local buybutton = workspace.Part.ClickDetector |
28 | local buybutton 1 = workspace.Part 1. ClickDetector |
30 | local developerproductid = 23348913 |
35 | buybutton.MouseClick:connect( function (player) |
36 | game:GetService( "MarketplaceService" ):PromptProductPurchase(game.Players.LocalPlayer, developerproductid) |
41 | buybutton 1. MouseClick:connect( function (player) |
42 | assetid = developerproductid |
44 | game:GetService( "MarketplaceService" ):PromptProductPurchase(game.Players.LocalPlayer, developerproductid) |
50 | shirtbutton.MouseClick:connect( function (player) |
53 | game:GetService( "MarketplaceService" ):PromptPurchase(game.Players.LocalPlayer, shirtid) |
58 | shirtbutton 1. MouseClick:connect( function (player) |
60 | game:GetService( "MarketplaceService" ):PromptPurchase(game.Players.LocalPlayer, shirtid) |
with this above, in a local script it is prompting everyone not just the player who clicks. and it shows the description gui to all players
but if i move it to a serverscript it only prompts the player who clicked. but it opens the description gui on all players.
11 | local function showinfoasset() |
12 | local store = script.Parent.store 1 |
13 | local image = store.frame.frame.Thumbnail |
14 | local name = store.frame.frame.ItemName |
15 | local price = store.frame.frame.CurrencyAmount |
16 | local price 2 = store.frame.frame.CurrencyAmount 2 |
17 | local disc = store.frame.description |
18 | local asset = game:GetService( "MarketplaceService" ):GetProductInfo(assetid) |
19 | price.Text = asset.PriceInRobux |
20 | price 2. Text = asset.PriceInTickets |
21 | disc.Text = asset.Description |
23 | store.frame.Visible = true |
29 | local function showinfoproduct() |
30 | local store = script.Parent.store 1 |
31 | local image = store.frame.frame.Thumbnail |
32 | local name = store.frame.frame.ItemName |
33 | local price = store.frame.frame.CurrencyAmount |
34 | local price 2 = store.frame.frame.CurrencyAmount 2 |
35 | local disc = store.frame.description |
36 | local asset = game:GetService( "MarketplaceService" ):GetProductInfo(assetid, Enum.InfoType.Product) |
37 | price.Text = asset.PriceInRobux |
38 | price 2. Text = asset.PriceInTickets |
39 | disc.Text = asset.Description |
41 | store.frame.Visible = true |
47 | local buybutton = workspace.Part.ClickDetector |
48 | local buybutton 1 = workspace.Part 1. ClickDetector |
49 | local developerproductid = 23348913 |
55 | buybutton.MouseClick:connect( function (player) |
56 | game:GetService( "MarketplaceService" ):PromptProductPurchase(player, developerproductid) |
61 | buybutton 1. MouseClick:connect( function (player) |
62 | assetid = developerproductid |
64 | game:GetService( "MarketplaceService" ):PromptProductPurchase(player, developerproductid) |
70 | local shirtbutton = game.Workspace.purple.shirtbuy.ClickDetector |
71 | local shirtbutton 1 = game.Workspace.purple 1. shirtbuy.ClickDetector |
73 | local shirtid = 235468209 |
79 | shirtbutton.MouseClick:connect( function (player) |
82 | game:GetService( "MarketplaceService" ):PromptPurchase(player, shirtid) |
87 | shirtbutton 1. MouseClick:connect( function (player) |
89 | game:GetService( "MarketplaceService" ):PromptPurchase(player, shirtid) |
ok fixed now. I've pasted the corrected script below.
05 | local function showinfoasset() |
06 | local store = game.Players:FindFirstChild(player.Name).PlayerGui.store |
07 | local image = store.frame.frame.Thumbnail |
08 | local name = store.frame.frame.ItemName |
09 | local price = store.frame.frame.CurrencyAmount |
10 | local price 2 = store.frame.frame.CurrencyAmount 2 |
11 | local disc = store.frame.description |
12 | local asset = game:GetService( "MarketplaceService" ):GetProductInfo(assetid) |
13 | price.Text = asset.PriceInRobux |
14 | price 2. Text = asset.PriceInTickets |
15 | disc.Text = asset.Description |
17 | store.frame.Visible = true |
23 | local function showinfoproduct() |
24 | local store = game.Players:FindFirstChild(player.Name).PlayerGui.store |
25 | local image = store.frame.frame.Thumbnail |
26 | local name = store.frame.frame.ItemName |
27 | local price = store.frame.frame.CurrencyAmount |
28 | local price 2 = store.frame.frame.CurrencyAmount 2 |
29 | local disc = store.frame.description |
30 | local asset = game:GetService( "MarketplaceService" ):GetProductInfo(assetid, Enum.InfoType.Product) |
31 | price.Text = asset.PriceInRobux |
32 | price 2. Text = asset.PriceInTickets |
33 | disc.Text = asset.Description |
35 | store.frame.Visible = true |
40 | local dvbutton = workspace.Part.ClickDetector |
41 | local dvbutton 1 = workspace.Part 1. ClickDetector |
42 | local developerproductid = 23348913 |
48 | dvbutton 1. MouseClick:connect( function (clicker) |
51 | game:GetService( "MarketplaceService" ):PromptProductPurchase(clicker, developerproductid) |
56 | dvbutton.MouseClick:connect( function (clicker) |
59 | assetid = developerproductid |
61 | game:GetService( "MarketplaceService" ):PromptProductPurchase(clicker, developerproductid) |