ChatService:GetSpeaker() isn't consistent

Hello everyone,

I’m making a chat tag system for my game using the roblox chat API. However, when I get the speaker object of the player it sometimes returns nil and sometimes doesn’t.

function TagsFunctions:EquipTag(PlayerName,Tag)

	local Player = PlayerService:FindFirstChild(PlayerName)
	local PlayerData = SavedPlayerDataManager.Profiles[Player]

	if PlayerData then

		local Table = TagsFunctions:GetEquippedTags(PlayerName)
		local Speaker 
		for i,v in ipairs(ChatService:GetSpeakerList()) do

			if v == PlayerName then
				Speaker = ChatService:GetSpeaker(PlayerName)

I’ve also tried directly get the speaker without the loop but that still didn’t work. Any one knows what’s the problem?

Thank you.

Why did you add the loop through the speakers , couldn’t you just do

Speaker = ChatService:GetSpeaker(PlayerName)

without the loop?

because that didn’t work either

Is this not a bit redundant, why not grab the player directly then check if it’s nil

local Speaker = ChatService:GetSpeaker(PlayerName)
if not Speaker then
  -- whoops?

If you’re getting inconsistent GetSpeaker calls, why not print the PlayerName and see what it is when you try to get the speaker

The problem doesn’t seem to be from the playername variable as this always returns the player name and never returns nil so the issue mostly stems doen from the ChatService:GetSpeaker call