Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. math.randomseed(tick())
  2. lootTypes = {
  3. Weapon = {
  4. {SpawnName = "Gun_AKM", Name = "AKM", Type = "Weapon", Rarity="VRare"},
  5. {SpawnName = "Gun_M4", Name = "M4", Type = "Weapon", Rarity="Rare"},
  6. {SpawnName = "Gun_M1911", Name = "M1911", Type = "Weapon", Rarity="Uncommon"},
  7. {SpawnName = "Melee_Pan", Name = "Frying Pan", Type = "Weapon", Rarity="Common"}},
  8.  
  9.  
  10.  
  11.  
  12. General = {
  13. {SpawnName = "7.62Ammo", Name = "7.62mm NATO", Type = "Ammo", Rarity="Common"},
  14. {SpawnName = "5.56Ammo", Name = "5.56mm", Type = "Ammo", Rarity="Common"},
  15. {SpawnName = ".45Ammo", Name = ".45 ACP", Type = "Ammo", Rarity="Common"},
  16. {SpawnName = "MotorHelmet", Name = "Motorcycle Helmet", Type = "Helmet", Rarity="Uncommon"},
  17. {SpawnName = "MiliHelmet", Name = "Military Helmet", Type = "Helmet", Rarity="Uncommon"},
  18. {SpawnName = "BalliVest", Name = "Ballistic Vest", Type = "Vest", Rarity="Rare"},
  19. {SpawnName = "MiliPack", Name = "Military Backpack", Type = "Backpack", Rarity="VRare"},
  20.  
  21. }
  22. }
  23.  
  24. Raritys = {"Common", "Uncommon", "Rare", "VRare"}
  25. colours = {
  26. ["VRare"] = Color3.fromRGB(255, 89, 89),
  27. ["Rare"] = Color3.fromRGB(4, 175, 236),
  28. ["Uncommon"] = Color3.fromRGB(0, 255, 0),
  29. ["Common"] = Color3.fromRGB(163, 162, 165)
  30.  
  31. }
  32.  
  33. --Grab all spawners
  34. local spawners = {}
  35. for _, v in pairs (workspace.SpawnLocations:GetChildren()) do
  36. table.insert(spawners, v)
  37. wait(0.1)
  38. end
  39.  
  40. function randSpawn(typ, rar)
  41. local randTab = {}
  42. for i,v in pairs(lootTypes[typ]) do
  43. wait(0.1)
  44. if v["Rarity"] == rar then
  45. table.insert(randTab, v)
  46. end
  47. end
  48. return randTab[math.random(#randTab)]
  49. end
  50.  
  51. function rarityRange()
  52. wait(0.1)
  53. local range = math.random(0,4700)
  54.  
  55. print(range)
  56.  
  57. if range <= 3000 then
  58. return "Common"
  59. elseif range >= 3001 and range <= 4000 then
  60. return "Uncommon"
  61. elseif range >= 4001 and range <= 4500 then
  62. return "Rare"
  63. else
  64. return "VRare"
  65. end
  66. end
  67.  
  68. function spawnLoot()
  69. local p = math.random(1, #spawners)
  70. local v = spawners[p]
  71. if v.Color == colours[rarity] then
  72. wait(0.1)
  73. local nameValue = Instance.new("StringValue")
  74. local randLoot = game.ReplicatedStorage[gotLoot]:Clone()
  75. randLoot.Parent = v
  76. randLoot.Position = randLoot.Parent.Position
  77. nameValue.Parent = randLoot
  78. nameValue.Value = item["Name"]
  79. end
  80. end
  81.  
  82. for i=0, 5 do
  83. wait(0.1)
  84. local p = math.random(1,2)
  85. local t = "Weapon"
  86. if p == 1 then
  87. t = "Weapon"
  88. else
  89. t = "General"
  90. end
  91.  
  92. item = randSpawn(t, rarityRange())
  93. gotLoot = item["SpawnName"]
  94. rarity = item["Rarity"]
  95.  
  96. spawnLoot()
  97. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement