I have a GUI that is attached to a Developer product, which costs 5 R$. I am having troubles, however, giving the player who buys it a item (Gun, sword, or any anything else). I have tried to script it, and even tried FM's. Is there a specific code that does this? If so, what is it?
To this hour, I have spent two days looking for it and I am frustrated.
I've went through the same pain you did. Basically you look for the player then check what product the player bought then add the item. What I do for PvP Battle. All you have to do is change what is in the if statement for the product id checker.
local prodId = 1 MarketplaceService.ProcessReceipt = function(receiptInfo) -- find the player based on the PlayerId in receiptInfo for i, player in ipairs(game.Players:GetChildren()) do if player.userId == receiptInfo.PlayerId then -- check which product was purchased (required, otherwise you'll award the wrong items if you're using more than one developer product) if(tonumber(receiptInfo.ProductId) == prodId)then --TODO: Buy the Ocherous Katana of the Setting Sun game.InsertService:LoadAsset(25545089).OrangeKatana.Parent = player.Backpack game.InsertService:LoadAsset(25545089).OrangeKatana.Parent = player.StarterGear end end end -- tell ROBLOX that we have successfully handled the transaction (required) return Enum.ProductPurchaseDecision.PurchaseGranted end
If I helped you up vote and accept my answer as the official answer.