Issue with map changing command (moves model to workspace and destroys other model in workspace)

Well, let’s simplify this a little bit.

local Admins = {"jees1"}

local Maps = {
game.ServerStorage.Map1;
game.ServerStorage.Map2;
game.ServerStorage.Map3;
game.ServerStorage.Map4;
}

local Folder = Instance.new("Folder")
Folder.Name = "MapsHolder"
Folder.Parent = workspace

function CheckAdmin(speaker)
	return table.find(Admins,speaker.Name) 
end

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg,rec)
		if msg then
			if CheckAdmin(player) then
				if string.sub(msg,1,11) == "!changemap " then
					local newmsg = string.sub(msg,12)
					if tonumber(newmsg) then
						Folder:ClearAllChildren()
						Maps[tonumber(newmsg)]:Clone().Parent = Folder
					end
				end
			end
		end
	end)
end)

Wasn’t able to test this so I’m not sure if it will work as intended, however let me know if it doesn’t. For clarification, use the commands as such:

!changemap 1
!changemap 2
etc.

Let’s start from the top:

The “CheckAdmin” function is bulky and can be shortened down to 1 line using table.find, that’s more of an apperance thing than anything else though. table.find() in this scenario uses (table, value).

There is a very clunky use of “FindFirstChild” as I’m sure you agree and that is no doubt contributing to errors so I’ve shortened it down using a simple method. By parenting all of the maps to a single folder you can use :ClearAllChildren() to remove all the maps, eliminating the need for all of the sanity checks.

You separated the “OnChatted” and player.Chatted in a very odd way so I’ve just grouped them together to eliminate that, however that’s also just an appearance issue.