Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:42:51

And it is not for any human being that Allah should speak to him except by revelation or from behind a partition or that He sends a messenger to reveal, by His permission, what He wills. Indeed, He is Most High and Wise.  

And it is not ˹possible˺ for any human that God should speak to him except, that He should reveal to him, by revelation, in sleep or by inspiration, or, except, from behind a veil, where He makes the person able to hear His speech but without seeing Him — as was the case with Moses, peace be upon him; or, except, that He should send a messenger, an angel, such as Gabriel, and he, the messenger, then reveals, to the person to whom he has been sent, that is to say, ˹and then˺ he speaks to him, with His permission, that is, God’s, whatever He, God, will. Truly He is Exalted, above the attributes of created beings, Wise, in His actions.
القرآن:٤٢:٥١

وَمَا كَانَ لِبَشَرٍ أَنْ يُكَلِّمَهُ اللَّهُ إِلَّا وَحْيًا أَوْ مِنْ وَرَاءِ حِجَابٍ أَوْ يُرْسِلَ رَسُولًا فَيُوحِيَ بِإِذْنِهِ مَا يَشَاءُ ۚ إِنَّهُ عَلِيٌّ حَكِيمٌ  

{وما كان لبشر أن يكلمه الله إلا} أن يوحي إليه {وحياً} في المنام أو بإلهام {أو} إلا {من وراء حجاب} بأن يسمعه كلامه ولا يراه كما وقع لموسى عليه السلام {أو} إلا أن {يرسل رسولاً} ملكاً كجبريل {فيوحي} الرسول إلى المرسل إليه أي يكلمه {بإذنه} أي الله {ما يشاء} الله {إنه عليّ} عن صفات المحدثين {حكيم} في صنعه.