How to fix gear spawners? It only works on one map

Hello, I want to know what is wrong with the script. Why do spawners work only on one map, and the code throws an error on other maps :question:

Here is some paths:

Map Location screenshot

Script path

:computer:Here is the code:

local RS = game:GetService("ReplicatedStorage")
local GearFolder = RS:WaitForChild("Gears"):GetChildren()

local MapHolder = RS:WaitForChild("MapHolder")

function chooseSpawn()
for i,v in pairs(MapHolder:GetChildren()) do
		local FindMapinWorkspace = game.Workspace:FindFirstChild(v.Name)
		local spawns = FindMapinWorkspace.SpawnFolder:GetChildren()
		if spawns  then		
		local _Spawn = spawns[math.random(1,#spawns)]

		return _Spawn	
		end
	end
end

local function chooseItem ()
	local item = GearFolder[math.random(1,#GearFolder)]

	return item
end

while task.wait(5) do
	local _spawn = chooseSpawn()
	local item = chooseItem()
	local clone = item:Clone()

	clone.Parent = game.Workspace
	clone.Handle.CFrame = _spawn.CFrame * CFrame.new(0,5,0)
end

I don’t quite know, I need a picture of the full map folder, but I know that it’s not saying that there isn’t a map folder because it’s saying the map doesn’t exist.

Hey there, here is the picture. The script doesn’t throw an error on “ChoasCanyon” map.
path2

I think I figured it out, you’re feeding it a table, you need to get the random child from the table, I hope this helps!

Im kinda new to scripting. I’ve tried doing like this and got an error.

error2

local RS = game:GetService("ReplicatedStorage")
local GearFolder = RS:WaitForChild("Gears"):GetChildren()

local MapHolder = RS:WaitForChild("MapHolder")


function chooseSpawn()
for i,v in pairs(MapHolder:GetChildren())  do
		local MapWorkspace = game.Workspace:FindFirstChild(v.Name)
		local RandomMapWorkspace = MapWorkspace[math.random(1,#MapWorkspace)]
		
		local spawns = RandomMapWorkspace.SpawnFolder:GetChildren()
		if spawns  then		
		local _Spawn = spawns[math.random(1,#spawns)]

		return _Spawn	
		end
	end
end

local function chooseItem ()
	local item = GearFolder[math.random(1,#GearFolder)]

	return item
end