hello, so im trying to write a chat thing where it adds a new speaker every time you chat. the issue is that to add a chat speaker, i must use the chatservice. but idk any way on how I can get the chat service. any help is appreciated.
local Players = game.Players
local FunctionId = "CrossServerMessaging"
local function Say(Speaker, Message, ChatService)
local NewSpeaker = ChatService:AddSpeaker(Speaker)
NewSpeaker:JoinChannel("All")
NewSpeaker:SayMessage(Message, "All", {NameColor = Color3.fromRGB(255, 0, 0)})
end
local function HideMessage(Speaker, Message, Channel, ChatService)
Say(Speaker, Message)
return true
end
local function Run(CS)
local thing = CS:RegisterProcessCommandsFunction(FunctionId, HideMessage)
print(thing)
end
return Run
you put a module in the ChatModules folder like so
the module should return a function. said function will run at runtime and ChatService will get passed to it.
-- example mode code
return function (ChatService)
ChatService:RegisterFilterMessageFunction("Test",function(sender, messageObject, channelName)
-- you can do whatever you want
end)
end
Remember if you still want to use default chat, make sure to have “InsertDefaultModules” set true. Otherwise you can set it to false (or remove it) and have a fully custom chat.