market = game:GetService("MarketplaceService")
local marketPlace = game:GetService("MarketplaceService")
marketPlace.ProcessReceipt = function(receipt)
player = game.Players:GetPlayerByUserId(receipt.PlayerId)
if receipt.CurrencySpent == 300 then
--gravity
if true then
return Enum.ProductPurchaseDecision.PurchaseGranted
end
game.ServerStorage.GravityCoil:Clone().Parent = player:WaitForChild("Backpack")
elseif receipt.CurrencySpent == 1 then
if true then
return Enum.ProductPurchaseDecision.PurchaseGranted
end
game.ServerStorage["Acceleration Coil"]:Clone().Parent = player:WaitForChild("Backpack")
--speed
end
end
✓ ANSWER ACCEPTED
Why won't this give the player the item when they buy the gamepass?
2 answers
✓ Accepted answer
Process Receipt is for dev products gamepass's have different things i'd recomend you look through the marketplace api wiki but this is what you need PromptGamePassPurchaseFinished
Thanks!! This worked.
market = game:GetService("MarketplaceService")
market.PromptGamePassPurchaseFinished:Connect(function(player, gamepass, purchase)
if purchase == true then
--gravity
if gamepass == 6632153 then
game.ServerStorage.GravityCoil:Clone().Parent = player.Backpack
elseif gamepass == 6632270 then
game.ServerStorage["Acceleration Coil"]:Clone().Parent = player.Backpack
--speed
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
