Ad
Log in to vote
0

Problem with a Dev Product giving a item from a gui?

Asked by 14 days ago
Edited 14 days ago

The dev product shows up when I click the TextButton but when I buy it I dont get the item. I have a script in ServerScriptService here it is.

local marketplaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local productId = 1338743761
local Tool = game.ReplicatedStorage.CuddlyCat
local Players = game:GetService("Players")

marketplaceService.ProcessReceipt = function(receipt)
    local player = players:GetPlayerByUserId(receipt.PlayerId)
    if not player then
        return Enum.ProductPurchaseDecision.NotProcessedYet
    end
    if receipt.ProductId == productId then
        Tool:Clone().Parent = Players.LocalPlayer.Backpack
    end
    return Enum.ProductPurchaseDecision.PurchaseGranted
end

and the localscript in the text button. Here it is.

local marketplaceService = game:GetService("MarketplaceService")
local productId = 1338743761

script.Parent.MouseButton1Click:Connect(function()
    marketplaceService:PromptProductPurchase(game.Players.LocalPlayer, productId)
end)
0
In the first script, change line 13 to `Tool:Clone().Parent = player.Backpack` because `Players.LocalPlayer` doesn't work on normal scripts. T3_MasterGamer 1002 — 13d
0
Thank you! :D tonomeow 5 — 13d

1 answer

Log in to vote
1
Answered by 13 days ago

All I had to do was replace line 13 in the first script with

Tool:Clone().Parent = player.Backpack

And it works now!

-credit to T3_MasterGamer for the answer.

Ad

Answer this question