Advertisement
Jackthehunter25

Untitled

Jan 24th, 2021
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. local petModule = {}
  2.  
  3. petModule.rarities = {
  4. Legendary = {
  5. ['LowBounds'] = 1;
  6. ['UpperBounds'] = 5;
  7. };
  8. Rare = {
  9. ['LowBounds'] = 6;
  10. ['UpperBounds'] = 20;
  11. };
  12. Uncommon = {
  13. ['LowBounds'] = 21;
  14. ['UpperBounds'] = 50;
  15. };
  16. Common = {
  17. ['LowBounds'] = 51;
  18. ['UpperBounds'] = 100;
  19. };
  20. };
  21.  
  22. petModule.Pets = {
  23. ["Legendary"] = {
  24. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Angelerfish");
  25. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Ultimus");
  26. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("LavaLord");
  27. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("DemonicDominus");
  28. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("lilfly");
  29. };
  30.  
  31. ["Rare"] = {
  32. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Angel");
  33. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("GoldenCat");
  34. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Jellyfish");
  35. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("LightBat");
  36. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("MythicalDemon");
  37. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Shark");
  38. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Snowman");
  39. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Starry");
  40. };
  41.  
  42. ["Uncommon"] = {
  43. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Builder");
  44. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Robot");
  45. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Fedora");
  46. };
  47.  
  48. ["Common"] = {
  49. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Cat");
  50. game.ReplicatedStorage:WaitForChild("Pets"):WaitForChild("Bear");
  51. };
  52. }
  53.  
  54.  
  55. function petModule.chooseRandomPet()
  56. local randomNumber = math.random(1, 100)
  57. local rarity
  58. for index, table in pairs(petModule.rarities) do
  59. if randomNumber >= table['LowBounds'] and randomNumber <= table['UpperBounds'] then
  60. rarity = index
  61. end
  62. end
  63. return petModule.Pets[rarity][math.random(1, #petModule.Pets[rarity])]
  64. end
  65.  
  66. print(petModule.chooseRandomPet())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement