So I tried to make one and it looks like it should work, but I ran test, spent 5 robux and I didin't get thing that I should get when I buy that product. Here is the script :
local buyButton = script.Parent
local productId = 33818042
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"Gems" then
plr.leaderstats.Gems.Value = plr.leaderstats.Gems.Value + 100
end
end
It seems like it should work but I didin't get my 100 gems. Help please.
