So I posted part of this code before where I had the 2 ends missing but now that I've finished it it still doesn't seem to work.
local MarketplaceService = game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
ID1 = 33445219 -- (5K) ID hawn
local ID1_Reward = 5000 -- ir-Reward hawn
ID2 = 33445422 -- (25K)
local ID2_Reward = 25000
ID3 = 33445463 -- (50K)
local ID3_Reward = 50000
ID4 = 33445512 -- (100K)
local ID4_Reward = 100000
MarketplaceService.ProcessReceipt = function(receiptInfo)
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_product_" .. receiptInfo.ProductId
local numberBought = ds:IncrementAsync(playerProductKey, 1)
for i,v in pairs (game.Players:GetChildren()) do
--ID 1
if v.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == ID1 then
local lds = game.ServerStorage:WaitForChild("PlayerMoney")
if lds ~= nil then
local cs = lds:FindFirstChild(v)
if cs ~= nil then
cs.Value = cs.Value + ID1_Reward
end
end
end
end
--ID 2
if v.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == ID2 then
local lds = game.ServerStorage:WaitForChild("PlayerMoney")
if lds ~= nil then
local cs = lds:FindFirstChild(v)
if cs ~= nil then
cs.Value = cs.Value + ID2_Reward
end
end
end
end
--ID 3
if v.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == ID3 then
local lds = game.ServerStorage:WaitForChild("PlayerMoney")
if lds ~= nil then
local cs = lds:FindFirstChild(v)
if cs ~= nil then
cs.Value = cs.Value + ID3_Reward
end
end
end
end
--ID 4
if v.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == ID4 then
local lds = game.ServerStorage:WaitForChild("PlayerMoney")
if lds ~= nil then
local cs = lds:FindFirstChild(v)
if cs ~= nil then
cs.Value = cs.Value + ID4_Reward
end
end
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end

2 comments
I've added it in a code block for you.
Ty :)