I have tried making script to handle donations by using developerproducts. my issue is that ProcessReceipt is running more than it should. upon donating the first time it works as expected.
donating the second time makes the function run twice, giving them 2x the “dono” points. the same applies to donating 3x and so on
My script incase needed:
local ID = {
[1] = 1885099102,
[2] = 0,
[3] = 0,
[4] = 0,
[5] = 0,
[6] = 0,
[7] = 0,
[8] = 0,
}
local Amount = {
[1885099102] = 10,
[1] = 50,
[2] = 100,
[3] = 250,
[4] = 500,
[5] = 750,
[6] = 1000,
[7] = 10000,
}
local MarketplaceService = game:GetService("MarketplaceService")
script.Purchase.OnServerEvent:Connect(function(plr, button)
MarketplaceService:PromptProductPurchase(plr, ID[button])
end)
MarketplaceService.ProcessReceipt = function(receiptInfo)
if receiptInfo then
if receiptInfo.PurchaseId then
local playerId = receiptInfo.PlayerId
local player = game.Players:GetPlayerByUserId(playerId)
local productId = receiptInfo.ProductId
player.DonoAmount.Value += Amount[productId]
end
end
end