GetSpeakerList returning an empty array in Studio

Perhaps I’m not understanding how the Lua Chat System works or I haven’t read documentation properly despite reciting that countless times to others, but ChatService.GetSpeakerList is returning an empty array. I know an array exists because an address is printed but the array has no children.

local ChatService = require(game.ServerScriptService.ChatServiceRunner.ChatService)
local Speakers = ChatService:GetSpeakerList()

print(Speakers)
for a,b in pairs(Speakers) do
    print(a, b)
end

Getting a speaker directly also returns nil, which means that to the command line or any external scripts, no chat speakers exist. This can’t be true because the Lua Chat System works in Studio and so do custom ChatModules.

I am running this code from the server view in the command line. Why is it empty?

1 Like

I have absolutely no clue why it’s doing this. It shouldn’t be either.

Live servers will still return a speaker appropriately if I require the ChatService and get the speaker related to my player. That much is fine. I wonder why it doesn’t work in Studio though? It’s just giving me a nil or blank table every time.

Doesn’t matter if I run this from the server or the client. It will not get a speaker and there is no code suggesting speakers aren’t added. I can very clearly see speakers get added because ChatModules function just fine. Even a custom ChatModule I created is able to access speakers without a single issue. What?

I am absolutely confused.

Output:
image

To explain the non-nil prints, they come from my ChatModule.
1 → speakerName
2 → ChatSpeaker PlayerInstance
3-5 → These are irrelevant.

ChatModules can get speakers but my external scripts can’t? Clearly this is not expected behaviour because I’ve also seen others’ scripts that are external being able to access ChatSpeakers without any issue. I am not using a forked chat system.

@PupNetx just saved my life but unfortunately I can’t get back the many hours I wasted on this problem. I had the inkling it was a simple problem. ChatService isn’t usable in the command line. I created a new script in ServerStorage with the same code and moved it into ServerScriptService - worked as expected.

1 Like