--Loot Spawn/Remover Script --By AllainceScripter local lootSpawners = game.Workspace.LootSpawns:GetChildren() local folders = { game.ReplicatedStorage.NormalGuns, game.ReplicatedStorage.Food, game.ReplicatedStorage.Drinks, game.ReplicatedStorage.Medical, game.ReplicatedStorage.Military, game.ReplicatedStorage.Clothes, game.ReplicatedStorage.Tools } game.Players.PlayerAdded:connect(function(plr) if plr.Name == "Player" then plr.Chatted:connect(function(msg) if msg == ";spawnLoot" then for i,v in pairs(lootSpawners) do if v.TypeOfLoot.Value == "normal" then local c = folders[1].M92FS:Clone() c.Parent = game.Workspace c.Handle.CFrame = game.Workspace.LootSpawns.NormalSpawn.CFrame + Vector3.new(math.random(1,10), 0, math.random(1,10)) elseif v.TypeOfLoot == "food" then local c = folders[2].Burger:Clone() c.Parent = game.Workspace c.Handle.CFrame = game.Workspace.LootSpawns.FoodSpawn.CFrame + Vector3.new(math.random(1,10), 0, math.random(1,10)) elseif v.TypeOfLoot == "drink" then local c = folders[3].WaterBottle:Clone() c.Parent = game.Workspace c.Handle.CFrame = game.Workspace.LootSpawns.DrinkSpawn.CFrame + Vector3.new(math.random(1,10), 0, math.random(1,10)) elseif v.TypeOfLoot == "medical" then local c = folders[4].Aid:Clone() c.Parent = game.Workspace c.Handle.CFrame = game.Workspace.LootSpawns.MedicalSpawn.CFrame + Vector3.new(math.random(1,10), 0, math.random(1,10)) elseif v.TypeOfLoot == "military" then local c = folders[5].M249:Clone() c.Parent = game.Workspace c.Handle.CFrame = game.Workspace.LootSpawns.MilitarySpawn.CFrame + Vector3.new(math.random(1,10), 0, math.random(1,10)) elseif v.TypeOfLoot == "clothing" then local c = folders[6].Cowboy:Clone() c.Parent = game.Workspace c.Handle.CFrame = game.Workspace.LootSpawns.ClothesSpawn.CFrame + Vector3.new(math.random(1,10), 0, math.random(1,10)) elseif v.TypeOfLoot == "tool" then local c = folders[7].Hammer:Clone() c.Parent = game.Workspace c.Handle.CFrame = game.Workspace.LootSpawns.ToolSpawn.CFrame + Vector3.new(math.random(1,10), 0, math.random(11,0)) end end end end) end end)
It only spawns the NormalGuns and not the rest when I say ;spawnLoot. What is wrong with this script? How can I fix it so that all the loot will be copied into the spawners?
Your "if" statements are inconsistent. You missed a ".Value" on all the "elseif"s.
elseif v.TypeOfLoot == "food" then
should be
elseif v.TypeOfLoot.Value == "food" then