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:
local buyButton = script.Parent
local productId = 19201593
local mps = game:GetService"MarketplaceService"
function getPlayerById(id)
for i,v in pairs(game.Players:GetPlayers()) do
if v.userId == id then
return v
end
end
end
buyButton.MouseButton1Click:connect(function()
mps:PromptProductPurchase(game.Players.LocalPlayer, productId)
end)
mps.ProcessReceipt = function(info)
local plr = getPlayerById(info.PlayerId)
if plr and plr:FindFirstChild"leaderstats" and plr.leaderstats:FindFirstChild"Credits" then
plr.leaderstats.Points.Value = plr.leaderstats.Credits.Value + 10000 --awards 10,000 credits when the player buys dev product
end
end
Please give me a answer! Thank you so much!!

2 comments
Woops
lol, We all make mistakes, as you may have noticed, I made a spelling error in my answer... :P