I just made some Dev products for coins and levels and this code does not work for some reason:
game.MarketplaceService.ProcessReceipt = function(receiptInfo)
local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
if receiptInfo.ProductId == 1216872108 then
plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + 100
end
end
You have to tell Roblox if the purchase works or not, try this
local Functions = {}
Functions[1216872108] = function(receiptInfo)
local plr = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId)
plr.leaderstats.Coins.Value += 100
end
game:GetService("MarketplaceService").ProcessReceipt = function(receiptInfo)
local Success, Err = pcall(Functions[receiptInfo.ProductId], receiptInfo)
if not Success then
warn(Err)
return Enum.ProductPurchaseDecision.NotProcessedYet
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Also, is there another script that uses ProcessReceipt? Only one can have that function
game.MarketplaceService.ProcessReceipt = function(receiptInfo)
local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
if receiptInfo.ProductId == 1216872108 and plr then
plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + 100
return Enum.ProductPurchaseDecision.PurchaseGranted
else
return Enum.ProductPurchaseDescision.NotProcessedYet
end
end