JoinChannel errors "attempt to call a nil value"

Global.SpeakerJoined:Connect(function(speakerName)
  speakerName:JoinChannel("Team")
end)

It errors ServerScriptService.Chat:9: attempt to call a nil value. Anyone knows why?

1 Like

speakerName is a string. You need a ChatSpeaker. i.e. ChatService:GetSpeaker(speakerName):JoinChannel("Team")

You may want nil checks though.

Yeah it doesn’t error anymore but the script isn’t working as expected, I’m trying to force them into team chat, do you know how I can do that?

Done in this game.

Have a look here

(I think it’s becuase you didn’t make your channel private