For some reason, this script doesn’t work. You can buy the product just fine but it won’t give you the currency.
local MS = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local id1 = 1157455472
local id2 = 1157455582
local id3 = 1157455666
local id4 = 1157455760
local id5 = 1157455909
local id6 = 1157455997
local function processReceipt(receiptInfo)
local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if player then
local c = game.Workspace:FindFirstChild(player.Name)
if receiptInfo.ProductId == id1 then
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 100000
elseif receiptInfo.ProductId == id2 then
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 250000
elseif receiptInfo.ProductId == id3 then
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 500000
elseif receiptInfo.ProductId == id4 then
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 5000000
elseif receiptInfo.ProductId == id5 then
c.Humanoid.Health = c.Humanoid.Health + 25
elseif receiptInfo.ProductId == id6 then
c.Humanoid.WalkSpeed = c.Humanoid.WalkSpeed + 10
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
MS.ProcessReceipt = processReceipt