This removes the space between 2 chapters only when they are just next to each other.
\documentclass{book}
\usepackage[titles]{tocloft}
\makeatletter
\newskip\old@cftbeforechapskip
\old@cftbeforechapskip\cftbeforechapskip
\let\old@l@chapter\l@chapter
\let\old@l@section\l@section
\def\l@chapter#1#2{\old@l@chapter{#1}{#2}\cftbeforechapskip3pt}% set your value here
\def\l@section#1#2{\old@l@section{#1}{#2}\cftbeforechapskip\old@cftbeforechapskip}
\makeatother
\begin{document}
\tableofcontents
\chapter{AAA}
\section{sss}
\chapter{BBB}
\section{ttt}
\chapter{CCC}
\chapter{DDD}
\end{document}
If you want to remove all the vertical spaces, you simply say the following instead of the long code in preamble:
\setlength{\cftbeforechapskip}{0pt}
\cftbeforechapskip
? Maybe try\setlength{cftbeforechapskip}{0pt}
. Also it would be easier to help you if you could provide an MWE next time.