Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

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

Asked by 14 days ago
Edited 14 days 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
print("cool")
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted 
end
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 Gameplayer365247v2 449 — 14d
0
and btw userId is not a valid member of a player, instead use UserId Gameplayer365247v2 449 — 14d
0
ok ill try thank u Zeppelin0330 7 — 14d
0
the popcorn itself is not going into the inventory now though Zeppelin0330 7 — 14d

Answer this question