I want to know the name of the function used to filter text, aka tagging chats, and how to use to the function for my custom chat.
You can use TextService:FilterStringAsync()
then use TextFilterResult:GetChatStringForUserAsync()
.
-- in the part of your script where message will be sent local TextService = game:GetService("TextService") local Result = TextService:FilterStringAsync(Message, Speaker.UserId) -- "Message" is the string of the speaker's message; "Speaker" is the Player instance of the player that wrote the message local Players = game:GetService("Players") for _, Player in ipairs(Players:GetPlayers()) do -- gets every player in the server if Player.Name ~= Speaker.Name then -- if Player is not Speaker local success, filteredMessage = pcall(Result.GetChatForUserAsync, Result, Player.UserId) -- Result:GetChatForUserAsync() but wrapped in pcall (protected call) to avoid errors that will break the script if success then -- no errors -- send the filtered message end end end -- the rest of the script
Make sure the script is a normal script or else it won't work. You have to get Speaker
and Message
somehow, probably by using a RemoteEvent
. In sending the message, you should use RemoteEvent
, too, to respect the receiver's chat filter settings.
As what @Ziffixture said, it is correct that you should search your problem before posting it here to avoid spam. I searched it and there's a ton of results with the same problem as yours and they are solved. Next time, search before posting, ok? :)