Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)

2 comments

0

In the first script, change line 13 to Tool:Clone().Parent = player.Backpack because Players.LocalPlayer doesn't work on normal scripts.

0

Thank you! :D

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.