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

Developer Products?? [[IMPORTANT]]

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

1 answer

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)

10 comments

0

@Ravenkiller Where it says productID do I put the gear or Developer Product??

1

That is the ID of the DeveloperProduct, in the Server side script you need to clone the tool into the Player's backpack.

0

How do I do that?

1

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)

0

Still doesn't work! :C

0

Do you get any errors in the output ?

0

Nope. Can you write the whole script for me in like a PM and I'll edit it?

0

I will edit my answer on here..

0

ok thanks

0

And....it still doesnt work.

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