If a child refuses to speak around adults but is comfortable speaking among kids, they may have selective mutism (SM). An inability to speak in certain social situations, despite comfortably speaking with immediate family members at home, difficulty initiating social interactions, and behavioral inhibition (i.e., looking frozen), are features that are often associated with SM.
You should seek an evaluation from a mental health professional to determine if they have SM. A mental health professional can properly assess them, determine a diagnosis, and initiate treatment.