I got a Pet system and I wanted to ask how can I make multiple Robux eggs in a module script?
Thats the module script.
local Eggs = {
Robux = {
Cost = 99,
Currency = "R$",
ProductID = 1528325390,
Pets = {
[1] = {Name = "", Type = "Normal", Rarity = 45000, Secret = false},
[2] = {Name = "", Type = "Normal", Rarity = 26000, Secret = false},
[3] = {Name = "", Type = "Normal", Rarity = 15000, Secret = false},
[4] = {Name = "", Type = "Normal", Rarity = 9000, Secret = false},
[5] = {Name = "", Type = "Normal", Rarity = 4000, Secret = false},
[6] = {Name = "", Type = "Normal", Rarity = 995, Secret = false},
}
},
Robux2 = {
Cost = 399,
Currency = "R$",
ProductID = 1528493634,
Pets = {
[1] = {Name = "", Type = "Normal", Rarity = 45000, Secret = false},
[2] = {Name = "", Type = "Normal", Rarity = 26000, Secret = false},
[3] = {Name = "", Type = "Normal", Rarity = 15000, Secret = false},
[4] = {Name = "", Type = "Normal", Rarity = 9000, Secret = false},
[5] = {Name = "", Type = "Normal", Rarity = 4000, Secret = false},
[6] = {Name = "", Type = "Normal", Rarity = 995, Secret = false},
}
},
Robux3 = {
Cost = 999,
Currency = "R$",
ProductID = 1528483458,
Pets = {
[1] = {Name = "", Type = "Normal", Rarity = 45000, Secret = false},
[2] = {Name = "", Type = "Normal", Rarity = 26000, Secret = false},
[3] = {Name = "", Type = "Normal", Rarity = 15000, Secret = false},
}
},
}
return Eggs
And thats the server script for the receipt:
for i,v in pairs(Eggs) do
local ProductID = v["ProductID"]
if ProductID ~= nil then
MS.ProcessReceipt = function(ReceiptInfo)
local Player = game:GetService("Players"):GetPlayerByUserId(ReceiptInfo.PlayerId)
if ReceiptInfo.ProductId == ProductID then
spawn(function()
local Result = singleEgg(Player, i)
RS.RemoteEvents.EggOpened:InvokeClient(Player, Eggs[i], Result)
end)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
end
end