System unable to get the speaker of a player

I’m trying to make an admin system that uses the chat system for command handling, but in studio, I’m unable to get it to get the player while in the player, I’m able to get it.

This is the chunk of code that makes up the core of the system

game:GetService("Players").PlayerAdded:Connect(function(plr)
	
	if getAdminLevel(plr) > 1 then
		game:GetService("Workspace"):WaitForChild(plr.Name)
		local chatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
		local speaker = chatService:GetSpeaker(plr.Name)
		local tries = 0
		if speaker == nil then
			repeat
				wait(1)
				print("Attempting to get the speaker of the new admin player...")
				speaker = chatService:GetSpeaker(plr.Name)
				wait(1)
				tries += 1
			until speaker ~= nil or tries > 5
			if tries > 5 then
				plr:Kick("Something went wrong while fetching admin stuff")
				return
			end
			print("Got the speaker of the new player")
		end
		speaker:JoinChannel(_G.adminConfiguration.channelName)
		speaker.SaidMessage:Connect(function(messageObject, channel)
			if channel == _G.adminConfiguration.channelName then
				local messageContent = messageObject.FilterResult
				if typeof(messageContent) == "Instance" then
					messageContent = messageObject.FilterResult:GetChatForUserAsync(plr.UserId)
				end
				if not startsWith(messageContent, _G.adminConfiguration.prefix) then return end
				local args = string.sub(messageContent, string.len(_G.adminConfiguration.prefix) + 1):split(" ")
				local command = tostring(table.remove(args, 1)):lower()
				local index = -1
				for i,v in pairs(_G.commands) do
					if v.Name == command then
						index = i
					end
				end
				if index == -1 then
					local botSpeaker = chatService:GetSpeaker("AdminSystemBot")
					botSpeaker:SayMessage("This is an invalid command, " .. plr.Name, _G.adminConfiguration.channelName, botSpeaker:GetExtraData("AdminSystemBotData"))
					return
				end
				_G.commands[index].CommandFile:Execute(plr, args)
			end
		end)
	end
	
end)

I’m not sure what’s causing it to fail, but it’s starting to become really annoying
Also, I would like some advice to try to clean up the code

Chat has a random chance to not work in studio
Also, instead of doing game:GetService(“Workspace”) use workspace instead.

Wow, that’s really annoying, surprised that it hasn’t been fixed after 2+ years

It was fixed but started occurring again since the last update.