I have a GUI Shop but I want people to buy things using Developers Products But I want them to buy a in-game gear that they get RIGHT when they buy it How do I do this?
✓ ANSWER ACCEPTED
How to get in-game gear from Developer Products?
1 answer
✓ Accepted answer
I don't know what your script looks like, but I have wrote a script for this situation.
productId = 19239712 -- You Dev Product ID here!
local MarketplaceService = Game:GetService("MarketplaceService")
function UsernameFromID(ID)
if type(ID) ~= "number" then
return
end
local sets = game:service("InsertService"):GetUserSets(ID)
for k, v in next, sets do
if v.Name == "My Models" then
return v.CreatorName
end
end
end
function giveRewards(player)
-- Put the function of you want to happen when bought here.
-- Example; The line below gets the Sword from lighting, then puts it into the players backpack by cloning it.
game.Lighting["Majestic Sword"]:Clone().Parent = player.Backpack
return Enum.ProductPurcaseDecision.PurchaseGranted
end
MarketplaceService.ProcessReceipt = function(receiptInfo)
giveRewards(UsernameFromID(receiptInfo.PlayerId))
end
script.Parent.MouseButton1Down:connect(function()
Game:GetService("MarketplaceService"):PromptProductPurchase(script.Parent.Parent.Parent.Parent, productId)
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
