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:
01 | local buyButton = script.Parent |
02 | local productId = 19201593 |
03 | local mps = game:GetService( "MarketplaceService" ) |
05 | function getPlayerById(id) |
06 | for i,v in pairs (game.Players:GetPlayers()) do |
13 | buyButton.MouseButton 1 Click:connect( function () |
14 | mps:PromptProductPurchase(game.Players.LocalPlayer, productId) |
17 | mps.ProcessReceipt = function (info) |
18 | local plr = getPlayerById(info.PlayerId) |
19 | if plr and plr:FindFirstChild( "leaderstats" ) and plr.leaderstats:FindFirstChild( "Credits" ) then |
20 | plr.leaderstats.Points.Value = plr.leaderstats.Credits.Value + 10000 |
If this doesn't work, then someone else will hopefully answer your question.