Buy coins for robux

Hello developers, I watched a tutorial on how to make a buy coins for robux. Currently I have 2 buttons for buying coins and 2 developer products. How would I make it so I have 6 buttons and 6 developer products in total. Would I just copy and paste this part of my script?
Serverscriptservice script:

local MPS = game:GetService(“MarketplaceService”)

MPS.ProcessReceipt = function(reciptInfo)
if reciptInfo.ProductId == 1257031148 then
local player = game.Players:GetPlayerByUserId(reciptInfo.PlayerId)
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value +100
return Enum.ProductPurchaseDecision.PurchaseGranted

> elseif reciptInfo.ProductId == 1257031563 then

local player = game.Players:GetPlayerByUserId(reciptInfo.PlayerId)
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value +250
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end

And here’s my other scripts.
inside here:
BuyCoinsScreenGui
script:

MPS = game:GetService(“MarketplaceService”)

id = 1257031563

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()

MPS:PromptProductPurchase(player, id)

end)

The other ones the same except just a different developer product id.
Thanks!

1 Like

Is that your script?

 local MPS = game:GetService(“MarketplaceService”)
 
 MPS.ProcessReceipt = function(reciptInfo)
 if reciptInfo.ProductId == 1257031148 then
 local player = game.Players:GetPlayerByUserId(reciptInfo.PlayerId)
 player.leaderstats.Coins.Value = player.leaderstats.Coins.Value +100
 return Enum.ProductPurchaseDecision.PurchaseGranted


 elseif reciptInfo.ProductId == 1257031563 then
local player = game.Players:GetPlayerByUserId(reciptInfo.PlayerId)
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value +250
 return Enum.ProductPurchaseDecision.PurchaseGranted
  end
 end

Then you can copy as many you want.

 elseif reciptInfo.ProductId == 1257031563 then
local player = game.Players:GetPlayerByUserId(reciptInfo.PlayerId)
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value +250
 return Enum.ProductPurchaseDecision.PurchaseGranted

Its probably best to use a Module Scripts for this type of stuff.