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 + 100000
end
end
For some reason, when I click it it does not work.
