-- Create the level loader

local function loadLevel(level)
	-- Clear the current level
	for _, enemy in pairs(gameState.enemies) do
		enemy:Destroy()
	end

	-- Create the new level
	local levelData = ReplicatedStorage.Levels[level]
	for _, enemyData in pairs(levelData.Enemies) do
		local enemy = game.ServerStorage.Enemies[enemyData.Name]:Clone()
		enemy.Parent = workspace
		gameState.enemies[#gameState.enemies + 1] = enemy
	end

	-- Set the new level
	gameState.level = level
end
