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.
✓ ANSWER ACCEPTED
How to filter a custom chat?
1 answer
✓ Accepted answer
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? :)
1 comment
0
tysm dude, also i will search it up next time, thanks XD
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
It's the 21st century. Google it genius.
jeez