Maybe connect the function directly with it? Remove or comemnt out the info function and replace the ProcessReceipt line with
MarketplaceService.ProcessReceipt = function(receiptInfo)
print("le swo")
if receiptInfo.ProductId == AssetID then
for _,v in pairs(workspace.ConfettiParts:GetDescendants()) do
if v:IsA("ParticleEmitter") then
v.Enabled = true
end
end
wait(15)
for _,v in pairs(workspace.ConfettiParts:GetDescendants()) do
if v:IsA("ParticleEmitter") then
v.Enabled = false
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
The only issue I believe is that something else is using processreceipt. Try doing CTRL+SHIFT+F and search for processreceipt and see if more than 1 thing is found, because this truly feels like something else is using processreceipt as well since the code should work.
Do you by any chance have that donation board model that shows the top donators?
That’s why it’s not working, the donation board uses process receipt. Go to the products script in that board, and uncomemnt that one script it tells you to if you have your own custom processreceipt. But before you do that, you need to get the original code that makes it work. So play the game, and find the script in boards that handles showing top donators, copy it somewhere, and in the processreceipt we’ve made, you combine the copied code with our custom process receipt
local Products = require(script.Parent.Products)
local Enabled = true
function GetData()
local Datastore = game:GetService("DataStoreService"):GetDataStore("BoardData")
local Data = Datastore:GetAsync("Data")
if Data == nil then
Data = {ListSize = 15, Datastore = 1, Refresh = 1, Version = 2}
end
local TD = "TopDonators"
if Data.Datastore ~= 1 then
TD = "TopDonators"..Data.Datastore
end
return TD
end
function ReceiptHandler()
warn("Donation Board: ProcessReceipt Activated")
game:GetService("MarketplaceService").ProcessReceipt = function(receiptInfo)
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_product_" .. receiptInfo.ProductId
local numberBought = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory"):IncrementAsync(playerProductKey, 1)
local ProductBought = game:GetService("DataStoreService"):GetDataStore("PurchaseHistoryCount"):IncrementAsync(receiptInfo.ProductId, 1)
local PlayerFound = false
for i, v in pairs (game.Players:GetChildren()) do
if v:IsA('Player') then
if v.userId == receiptInfo.PlayerId then
for _, p in pairs (Products.Products) do
if p.ProductId == receiptInfo.ProductId then
if v ~= nil then
PlayerFound = true
game:GetService("DataStoreService"):GetOrderedDataStore(GetData()):IncrementAsync(receiptInfo.PlayerId, p.ProductPrice)
end
end
end
end
end
end
if PlayerFound ~= true then
return Enum.ProductPurchaseDecision.NotProcessedYet
else
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
end
if Products.AbortCustomPurchases then
if Products.AbortCustomPurchases == true then
Enabled = false
warn("Donation Board: Custom ProcessReceipt Enabled!")
else
ReceiptHandler()
end
else
ReceiptHandler()
end
ConfettiCannonScript:
--Services--
local MarketplaceService = game:GetService("MarketplaceService")
--Integer Defintions--
local AssetID = 1153097919
local function info(receiptInfo)
print("le swo")
if receiptInfo.ProductId == AssetID then
for _,v in pairs(workspace.ConfettiParts:GetDescendants()) do
if v:IsA("ParticleEmitter") then
v.Enabled = true
end
end
wait(15)
for _,v in pairs(workspace.ConfettiParts:GetDescendants()) do
if v:IsA("ParticleEmitter") then
v.Enabled = false
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
MarketplaceService.ProcessReceipt = info
In the CofettiCannonScript’s info function, try this
local function info(receiptInfo)
print("le swo")
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_product_" .. receiptInfo.ProductId
local numberBought = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory"):IncrementAsync(playerProductKey, 1)
local ProductBought = game:GetService("DataStoreService"):GetDataStore("PurchaseHistoryCount"):IncrementAsync(receiptInfo.ProductId, 1)
if receiptInfo.ProductId == AssetID then
for _,v in pairs(workspace.ConfettiParts:GetDescendants()) do
if v:IsA("ParticleEmitter") then
v.Enabled = true
end
end
wait(15)
for _,v in pairs(workspace.ConfettiParts:GetDescendants()) do
if v:IsA("ParticleEmitter") then
v.Enabled = false
end
end
else
local PlayerFound = false
for i, v in pairs (game.Players:GetChildren()) do
if v:IsA('Player') then
if v.userId == receiptInfo.PlayerId then
for _, p in pairs (products.Products) do
if p.ProductId == receiptInfo.ProductId then
if v ~= nil then
PlayerFound = true
game:GetService("DataStoreService"):GetOrderedDataStore("TopDonators"):IncrementAsync(receiptInfo.PlayerId, p.ProductPrice)
end
end
end
end
end
end
if PlayerFound ~= true then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
MarketplaceService.ProcessReceipt = function(receiptInfo)
Wait I just realised an issue. In the top before the function, insert this
local products = require(workspace.Boards.Products) --Replace workspace.Boards.Products with the location of the products script
local productfuncs = {}
I’m afraid you’ll have to disable your own script and modify the board one.
So, disable your script and enable board script. Modify the board script with this one
local AssetID = 1153097919
local Products = require(script.Parent.Products)
local Enabled = true
function GetData()
local Datastore = game:GetService("DataStoreService"):GetDataStore("BoardData")
local Data = Datastore:GetAsync("Data")
if Data == nil then
Data = {ListSize = 15, Datastore = 1, Refresh = 1, Version = 2}
end
local TD = "TopDonators"
if Data.Datastore ~= 1 then
TD = "TopDonators"..Data.Datastore
end
return TD
end
function ReceiptHandler()
warn("Donation Board: ProcessReceipt Activated")
game:GetService("MarketplaceService").ProcessReceipt = function(receiptInfo)
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_product_" .. receiptInfo.ProductId
local numberBought = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory"):IncrementAsync(playerProductKey, 1)
local ProductBought = game:GetService("DataStoreService"):GetDataStore("PurchaseHistoryCount"):IncrementAsync(receiptInfo.ProductId, 1)
local PlayerFound = false
for i, v in pairs (game.Players:GetChildren()) do
if v:IsA('Player') then
if v.userId == receiptInfo.PlayerId then
for _, p in pairs (Products.Products) do
if p.ProductId == receiptInfo.ProductId then
if v ~= nil then
PlayerFound = true
game:GetService("DataStoreService"):GetOrderedDataStore(GetData()):IncrementAsync(receiptInfo.PlayerId, p.ProductPrice)
end
end
end
end
end
end
if receiptInfo.ProductId == AssetID then
PlayerFound = true;
spawn(function() -- don't make the callback wait
for _,v in pairs(workspace.ConfettiParts:GetDescendants()) do
if v:IsA("ParticleEmitter") then
v.Enabled = true
end
end
wait(15)
for _,v in pairs(workspace.ConfettiParts:GetDescendants()) do
if v:IsA("ParticleEmitter") then
v.Enabled = false
end
end
end);
end
if PlayerFound ~= true then
return Enum.ProductPurchaseDecision.NotProcessedYet
else
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
end
if Products.AbortCustomPurchases then
if Products.AbortCustomPurchases == true then
Enabled = false
warn("Donation Board: Custom ProcessReceipt Enabled!")
else
ReceiptHandler()
end
else
ReceiptHandler()
end
As of now I don’t believe he has to modify the one the boards uses since in this game I’m helping to program, it worked fine when I added to the function I made, so it’ll hopefully work here. But my function will definitely need improvement as it’s jsut the basics of what is needed since there can be many issues that can arise, such as the player leaving during a purchase and what not
That didn’t break anything when I used a custom processreceipt since the original scripts are not tampered with, since if it notices taht AbortCustomPurchases is true, it knows a custom receipt is being used.
Oh and the GetData() function is only needed for its processreceipt, in the Products function, the comments at the end state
--For the more advanced scripters, READ THIS!
--if you're already using the function ProcessReceipt then you must add custom code for this ---board to work,
--as only one of these functions may be used in a game.
--to disable the ProcessReceipt function from this board, unquote this above the 'return module' line:
--module.AbortCustomPurchases = true
--you can update the boards datastore with this line:
--game:GetService("DataStoreService"):GetOrderedDataStore("TopDonators"):IncrementAsync(PlayerId, ProductPrice)
--PlayerId, the id from the player who bought the pruduct.
--ProductPrice, the developer products price (In Rs!)
The TopDonators datastore is if you’re using a custom processReceipt
I could of be of assistance if required, I’ve had some experience having to modify the processreceipt of the board before, so me and Whitex can both help