I'm making a shop GUI and when I click the button it pops up with a buy option and when you buy the gear (WITH ROBUX) it gives you the gear.
Someone help??? thanks
I'm making a shop GUI and when I click the button it pops up with a buy option and when you buy the gear (WITH ROBUX) it gives you the gear.
Someone help??? thanks
This is the sort of thing that you are looking at.. (Client side / LocalScript) - Place in TextButton
local player = game.Players.LocalPlayer
local MarketplaceService = Game:GetService("MarketplaceService")
local Button = script.Parent
local productId = 0 -- Put your gear ID here.
Button.MouseButton1Click:connect(function()
MarketplaceService:PromptProductPurchase(player, productId)
end)
(Server side / Script) - Place in Workspace
local MarketplaceService = Game:GetService("MarketplaceService")
local Tool = game:GetService("ServerStorage")['ToolName'] -- Place tool in ServerStorage and change name here.
MarketplaceService.ProcessReceipt = function(receiptInfo)
for _, v in pairs(game.Players:GetChildren()) do
if v.userId == receiptInfo.PlayerId then
local T = Tool:Clone()
T.Parent = v.Backpack
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
10 comments
@Ravenkiller Where it says productID do I put the gear or Developer Product??
That is the ID of the DeveloperProduct, in the Server side script you need to clone the tool into the Player's backpack.
How do I do that?
Place a copy of the tool in ServerStorage and do something like this: local Tool = game:GetService("ServerStorage")['ToolName']:Clone() Tool.Parent = Player.Backpack -- Change ToolName with the tool's name (v is the Player in the second script)
Still doesn't work! :C
Do you get any errors in the output ?
Nope. Can you write the whole script for me in like a PM and I'll edit it?
I will edit my answer on here..
ok thanks
And....it still doesnt work.