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

MarketPlaceService won't work? [UNANSWERED] [PLEASE ANSWER]

Asked by 10 years ago

Ok, just to let you know this is in a LOCAL SCRIPT. Also, this is in a TextButton in a Surface GUI. There are four different copies of the same surface gui. If you don t understand what I mean about four different copies, click here Accaully, you might want to click that link because It explains the script a whole lot better. Oh, yeah! I have a leaderboard for this script too.

Here is the script:

01local buyButton = script.Parent
02local productId = 19201593
03local mps = game:GetService"MarketplaceService"
04 
05function getPlayerById(id)
06for i,v in pairs(game.Players:GetPlayers()) do
07if v.userId == id then
08return v
09end
10end
11end
12 
13buyButton.MouseButton1Click:connect(function()
14mps:PromptProductPurchase(game.Players.LocalPlayer, productId)
15end)
View all 22 lines...

Please give me a answer! Thank you so much!!

1 answer

Log in to vote
1
Answered by
Xetrax 85
10 years ago

The firs thing I noticed is that your local mps = game:GetService"MarketplaceService" line and your other lines: plr:FindFirstChild"leaderstats", plr.leaderstats:FindFirstChild"Credits" arn't structured correctly for the script to work, make sure when you do :FindFirstChild() and :GetService() that you actually have the () when you tyoe them, typing what you have put will confuse the script, because you're not specifying what it has to do; try this:

01local buyButton = script.Parent
02local productId = 19201593
03local mps = game:GetService("MarketplaceService")   --adding the () specifies what you want the script to do, as far as I understand it.
04 
05function getPlayerById(id)
06for i,v in pairs(game.Players:GetPlayers()) do
07if v.userId == id then
08return v
09end
10end
11end
12 
13buyButton.MouseButton1Click:connect(function()
14mps:PromptProductPurchase(game.Players.LocalPlayer, productId)
15end)
View all 22 lines...

If this doesn't work, then someone else will hopefully answer your question.

0
Woops PyccknnXakep 1225 — 10y
0
lol, We all make mistakes, as you may have noticed, I made a spelling error in my answer... :P Xetrax 85 — 10y
Ad

Answer this question