God communicated with prophets through direct speech, like in the case of Moses (peace be upon him) so that in Islam he was entitled ''Kalimullah'' or the one who always talked to God.
The Qur’an says what means:
{Allah talked to Moses.} (An-Nisaa' 4:164)
Or He communicated with them through indirect speech (revelation), like in the case of our Prophet Muhammad (peace be upon him). The Qur’an says:
{And unto you have We revealed the Scripture (Qur’an) with the truth confirming whatever Scripture was before it, and a watcher over it.} (Al-Ma'idah5:48)
And: