New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Still have questions? Join our Discord server and get real time help.
Log in to vote

Why is my prompt purchase not giving the player the product?

Asked by 3 months ago
Edited 3 months ago

The prompt purchase appears correctly however when the transaction is completed the product does not appear in their inventory. This script is located in ServerScriptService and the tool is located in Replicated Storage. When I run it gives me no error but still wont put the popcorn in to the players backpack. Any help is appreciated.

local MarketplaceService = game:GetService("MarketplaceService")
MarketplaceService.ProcessReceipt = function(receiptInfo)
local players = game.Players:GetPlayers()
for i=1,#players do
if players[i].UserId == receiptInfo.PlayerId then
    local RS = game:GetService("ReplicatedStorage")
    local item = RS:WaitForChild("Popcorn")
    local cloned = item:Clone()
    local player = game.Players:GetChildren()
    cloned.Parent = player.Backpack
    cloned.Parent = player.StarterGear
return Enum.ProductPurchaseDecision.PurchaseGranted 
the server cant access players, only a local script can but what i think you can do is local players = game.Players:GetChildren() but im not sure Gameplayer365247v2 729 — 3mo
and btw userId is not a valid member of a player, instead use UserId Gameplayer365247v2 729 — 3mo
ok ill try thank u Zeppelin0330 9 — 3mo
the popcorn itself is not going into the inventory now though Zeppelin0330 9 — 3mo

Answer this question