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
print("cool")
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted	
end

4 comments

0

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

0

and btw userId is not a valid member of a player, instead use UserId

0

ok ill try thank u

0

the popcorn itself is not going into the inventory now though