Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local petModule = {}
- petModule.rarities = {
- Legendary = {
- ['LowBounds'] = 1;
- ['UpperBounds'] = 5;
- };
- Rare = {
- ['LowBounds'] = 6;
- ['UpperBounds'] = 20;
- };
- Uncommon = {
- ['LowBounds'] = 21;
- ['UpperBounds'] = 50;
- };
- Common = {
- ['LowBounds'] = 51;
- ['UpperBounds'] = 100;
- };
- };
- petModule.Pets = {
- ["Legendary"] = {
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Angelerfish");
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Ultimus");
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("LavaLord");
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("DemonicDominus");
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("lilfly");
- };
- ["Rare"] = {
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Angel");
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("GoldenCat");
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Jellyfish");
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("LightBat");
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("MythicalDemon");
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Shark");
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Snowman");
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Starry");
- };
- ["Uncommon"] = {
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Builder");
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Robot");
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Fedora");
- };
- ["Common"] = {
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Cat");
- game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Bear");
- };
- }
- function petModule.chooseRandomPet()
- local randomNumber = math.random(1, 100)
- local rarity
- for index, table in pairs(petModule.rarities) do
- if randomNumber >= table['LowBounds'] and randomNumber <= table['UpperBounds'] then
- rarity = index
- end
- end
- return petModule.Pets[rarity][math.random(1, #petModule.Pets[rarity])]
- end
- print(petModule.chooseRandomPet())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement