Lua Chat: Channel does not exist but I can see it and use it

I have two text channels, “All” which is the default, and “Staff”. They both show up when I join the game.
image

This is the script used to create the channels

local plrs = game:GetService("Players")
local sss = game:GetService("ServerScriptService")

local chatService = require(sss:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))

local staffChannel = chatService:AddChannel("Staff")
staffChannel.Joinable = false
staffChannel.AutoJoin = false

chatService.SpeakerAdded:Connect(function(name)
	local plr = game.Players:FindFirstChild(name)
	if plr and plr:GetRankInGroup(1156950) >= 190 then
		local speaker = chatService:GetSpeaker(name)
		speaker:JoinChannel("Staff")
	end
end)

I have a local script, it changes the settings and all but when I use ChatWindow:ChangeCurrentChannel() it returns an error even though the chat clearly exists
image

local chat = game:GetService("Chat")
local chatModules = chat:WaitForChild("ClientChatModules")
local chatSettings = require(chatModules:WaitForChild("ChatSettings"))
local chatWindow = require(chat:WaitForChild("ChatScript"):WaitForChild("ChatMain"):WaitForChild("ChatWindow")).new()

chatSettings.ShowChannelsBar = true
chatSettings.EchoMessagesInGeneralChannel = false

chatWindow:AddChannel("Staff")

GetChannel returns nil in the client but returns the correct channel in the server

With this said, I have also tried using :AddChannel() just because maybe that was causing the whole thing but it returns this error
image

I have spent hours looking for a solution, tried everything I could find on the devhub but nothing seems to work.

2 Likes