Hello, Developer community!
I recently ran into an issue regarding ProcessReceipt.
The issue is that my code doesn’t seem to be firing (evidenced by the valid sounds not playing, leader stats staying the same, and the donation message not being sent.)
I had done my research on how to fix this problem, but I couldn’t find a vital solution. My code changes haven’t worked either.
Would anyone be able to pinpoint the issue in the code?
MarketplaceService.ProcessReceipt = function(recieptInfo)
local playerPurchasing = game.Players:GetPlayerByUserId(recieptInfo.PlayerId)
if not playerPurchasing then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
local productId = recieptInfo.ProductId
local productInfo = MarketplaceService:GetProductInfo(productId, Enum.InfoType.Product)
if productInfo then
if game.Players:GetPlayerByUserId(recieptInfo.PlayerId) then
local leaderstats = playerPurchasing:FindFirstChild("leaderstats")
if leaderstats then
local money = leaderstats:FindFirstChild("Money")
local donated = leaderstats:FindFirstChild("Donated")
if donated and money then
donated.Value += productInfo.PriceInRobux
money.Value += productInfo.PriceInRobux * 3
if game.Players:GetPlayerByUserId(productInfo.Creator.CreatorTargetId) then
game.Players:GetPlayerByUserId(productInfo.Creator.CreatorTargetId).leaderstats.Raised.Value += productInfo.PriceInRobux
game.Players:GetPlayerByUserId(productInfo.Creator.CreatorTargetId).leaderstats.money.Value += productInfo.PriceInRobux * 2
local skyscraper = findSkyscraperByOwner(game.Players:GetPlayerByUserId(productInfo.Creator.CreatorTargetId).Name)
wait(0.01)
if skyscraper ~= nil then
if productInfo.PriceInRobux <= 20 then
game.Workspace[skyscraper].Area.SmallDonation:Play()
game.Workspace[skyscraper].Area.DonationOverlay:Play()
elseif productInfo.PriceInRobux >= 20 and productInfo.PriceInRobux <= 100 then
game.Workspace[skyscraper].Area.DonationOverlay:Play()
game.Workspace[skyscraper].Area.MidDonation:Play()
elseif productInfo.PriceInRobux >= 100 and productInfo.PriceInRobux <= 1000 then
game.Workspace[skyscraper].Area.DonationOverlay:Play()
game.Workspace[skyscraper].Area.MidDonation:Play()
game.Workspace[skyscraper].Area.Explode:Play()
elseif productInfo.PriceInRobux >= 1000 and productInfo.PriceInRobux <= 10000 then
game.Workspace[skyscraper].Area.SmallDonation:Play()
game.Workspace[skyscraper].Area.DonationOverlay:Play()
game.Workspace[skyscraper].Area.MidDonation:Play()
game.Workspace[skyscraper].Area.Impact:Play()
game.Workspace[skyscraper].Area.Explode:Play()
elseif productInfo.PriceInRobux >= 10000 and productInfo.PriceInRobux <= 1000000 then
game.Workspace[skyscraper].Area.DonationOverlay:Play()
game.Workspace[skyscraper].Area.LargeDonation:Play()
game.Workspace[skyscraper].Area.Explode:Play()
elseif productInfo.PriceInRobux >= 1000000 then
game.Workspace[skyscraper].Area.MassiveDonation:Play()
game.Workspace[skyscraper].Area.LargeDonation:Play()
game.Workspace[skyscraper].Area.Explode:Play()
end
remote:FireAllClients("[System] @" .. playerPurchasing.Name .. " donated \u{E002}" .. productInfo.PriceInRobux .. " to @" .. game.Players:GetPlayerByUserId(productInfo.Creator.CreatorTargetId).Name, Color3.fromRGB(0, 255, 8), Enum.Font.FredokaOne, Enum.FontSize.Size24)
end
local leaderstats2 = game.Players:GetPlayerByUserId(productInfo.Creator.CreatorTargetId):FindFirstChild("leaderstats")
if leaderstats2 then
local money2 = leaderstats2:FindFirstChild("Money")
local raised = leaderstats2:FindFirstChild("Raised")
if raised and money2 then
raised.Value += productInfo.PriceInRobux
money2.Value += productInfo.PriceInRobux * 2
end
end
end
end
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
I have looked into similar topics too, but they haven’t helped me with this issue.