lighting = game:GetService("Lighting")
assets = lighting.Assets
items = assets.Items
loot = {}
for _, child in pairs(game.Workspace.Void.Loot:GetChildren()) do
table.insert(loot, child.Name)
end
common = {
"Part"
}
uncommon = {
"CornerWedge"
}
rare = {
"Truss"
}
legendary = {
"Wedge"
}
exotic = {
"WedgeLarge"
}
function spawnloot()
for _, v in pairs(loot) do
local item
if v.Name == "Common" then
item = common[math.random(#common)]
elseif v.Name == "Uncommon" then
item = uncommon[math.random(#uncommon)]
elseif v.Name == "Rare" then
item = rare[math.random(#rare)]
elseif v.Name == "Legendary" then
item = legendary[math.random(#legendary)]
elseif v.Name == "Exotic" then
item = exotic[math.random(#exotic)]
end
if item then
local randomloot = items[item]:Clone()
randomloot.Parent = game.Workspace
randomloot.CFrame = v.CFrame
end
end
end
while true do
wait(1) --360 seconds; 6 minutes
spawnloot()
end
Why wont this work? I get no errors...
