If this occurs, your multiplayer setting is likely turned off.
From the Home screen, go to Settings > Screen Time > Content & Privacy Restrictions > Store, Web, Siri & Game Center Content.
Under the Multiplayer Games section, change from “Don't Allow” to the option you would like.