Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- math.randomseed(tick())
- lootTypes = {
- Weapon = {
- {SpawnName = "Gun_AKM", Name = "AKM", Type = "Weapon", Rarity="VRare"},
- {SpawnName = "Gun_M4", Name = "M4", Type = "Weapon", Rarity="Rare"},
- {SpawnName = "Gun_M1911", Name = "M1911", Type = "Weapon", Rarity="Uncommon"},
- {SpawnName = "Melee_Pan", Name = "Frying Pan", Type = "Weapon", Rarity="Common"}},
- General = {
- {SpawnName = "7.62Ammo", Name = "7.62mm NATO", Type = "Ammo", Rarity="Common"},
- {SpawnName = "5.56Ammo", Name = "5.56mm", Type = "Ammo", Rarity="Common"},
- {SpawnName = ".45Ammo", Name = ".45 ACP", Type = "Ammo", Rarity="Common"},
- {SpawnName = "MotorHelmet", Name = "Motorcycle Helmet", Type = "Helmet", Rarity="Uncommon"},
- {SpawnName = "MiliHelmet", Name = "Military Helmet", Type = "Helmet", Rarity="Uncommon"},
- {SpawnName = "BalliVest", Name = "Ballistic Vest", Type = "Vest", Rarity="Rare"},
- {SpawnName = "MiliPack", Name = "Military Backpack", Type = "Backpack", Rarity="VRare"},
- }
- }
- Raritys = {"Common", "Uncommon", "Rare", "VRare"}
- colours = {
- ["VRare"] = Color3.fromRGB(255, 89, 89),
- ["Rare"] = Color3.fromRGB(4, 175, 236),
- ["Uncommon"] = Color3.fromRGB(0, 255, 0),
- ["Common"] = Color3.fromRGB(163, 162, 165)
- }
- --Grab all spawners
- local spawners = {}
- for _, v in pairs (workspace.SpawnLocations:GetChildren()) do
- table.insert(spawners, v)
- wait(0.1)
- end
- function randSpawn(typ, rar)
- local randTab = {}
- for i,v in pairs(lootTypes[typ]) do
- wait(0.1)
- if v["Rarity"] == rar then
- table.insert(randTab, v)
- end
- end
- return randTab[math.random(#randTab)]
- end
- function rarityRange()
- wait(0.1)
- local range = math.random(0,4700)
- print(range)
- if range <= 3000 then
- return "Common"
- elseif range >= 3001 and range <= 4000 then
- return "Uncommon"
- elseif range >= 4001 and range <= 4500 then
- return "Rare"
- else
- return "VRare"
- end
- end
- function spawnLoot()
- local p = math.random(1, #spawners)
- local v = spawners[p]
- if v.Color == colours[rarity] then
- wait(0.1)
- local nameValue = Instance.new("StringValue")
- local randLoot = game.ReplicatedStorage[gotLoot]:Clone()
- randLoot.Parent = v
- randLoot.Position = randLoot.Parent.Position
- nameValue.Parent = randLoot
- nameValue.Value = item["Name"]
- end
- end
- for i=0, 5 do
- wait(0.1)
- local p = math.random(1,2)
- local t = "Weapon"
- if p == 1 then
- t = "Weapon"
- else
- t = "General"
- end
- item = randSpawn(t, rarityRange())
- gotLoot = item["SpawnName"]
- rarity = item["Rarity"]
- spawnLoot()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement