Here's my code:
local MarketplaceService = game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local pid1 = 427571385
local pid2 = 427132153
local pid3 = 427572442
local pid4 = 427573555
local pid5 = 427131963
local pid6 = 427132153
local pid7 = 427132281
local pid8 = 427132336
MarketplaceService.ProcessReceipt = function(receiptInfo)
for i, player in ipairs(game.Players:GetPlayers()) do
local Rubys = player.Rubys
local Coins = player.Coins
if player.userId == receiptInfo.PlayerId then
elseif receiptInfo.ProductId == pid1 then
Rubys.Value = Rubys.Value + 100
elseif receiptInfo.ProductId == pid2 then
Rubys.Value = Rubys.Value + 300
elseif receiptInfo.ProductId == pid3 then
Rubys.Value = Rubys.Value + 750
elseif receiptInfo.ProductId == pid4 then
Rubys.Value = Rubys.Value + 1250
----------- C O I N S ---------
elseif receiptInfo.ProductId == pid5 then
Coins.Value = Coins.Value + 1000
elseif receiptInfo.ProductId == pid6 then
Coins.Value = Coins.Value + 2800
elseif receiptInfo.ProductId == pid7 then
Coins.Value = Coins.Value + 7500
elseif receiptInfo.ProductId == pid8 then
Coins.Value = Coins.Value + 13500
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
If you're able to find the problem please give me a detailed explanation on where I would add to the script to make it work.

1 comment
-1 for not explaining.