There is no need for me to paste the contents of the script, because when I put it in another game it works perfectly fine, but when I put it in the game I want, it doesn't work. Well, I should probably put the script in anyways because it would be hard to know what I'm talking about without it. (ids replaced with (id))
local mps = game:GetService("MarketplaceService")
local chicken = (id)
local bucket = (id)
local datastore = game:GetService("DataStoreService")
local Previous = datastore:GetDataStore("Previous")
local storage = game:GetService("ServerStorage")
mps.ProcessReceipt = function(receipt)
print("Bought")
local id = receipt.PlayerId.."-"..receipt.PurchaseId
local success
pcall(function()
success = Previous:GetAsync(id)
end)
if success then
return Enum.ProductPurchaseDecision.PurchaseGranted
end
local player = game.Players:GetPlayerByUserId(receipt.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
else
if receipt.ProductId == chicken then
print("Bought chicken")
local chicken = storage:WaitForChild("Chicken"):Clone()
chicken.Parent = player.Backpack
end
if receipt.ProductId == bucket then
local bucket = storage:WaitForChild("KFC"):Clone()
bucket.Parent = player.Backpack
end
pcall(function()
Previous:SetAsync(id,true)
end)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
I get errors saying things like "purchase is already being processed" and "datastore queue is overflowed" and stuff, but here's the kicker. Whenever I put it in a different game, it works perfectly. If it helps, there is a donation board in the game that also uses the ProcessReceipt function, does this affect this script in any way?

3 comments
only one function can be assigned to ProcessReceipt, since it's a callback, not an event
you'll have to combine the donation board and your purchase processing thingy
Ill do that ty