game.Players.ChildAdded:connect(function(plry)
if plry:IsA("Player") then
plry.Chatted:connect(function(msg)
local color = {"White"}
local chat = game:GetService("Chat")
chat:Chat(plry.Character.Head), msg, color[math.random(1,1)] )
end)
end
end)
COMMUNITY QUESTION
How would I filter this chat so no swearing and stuff?
1 answer
FilterStringAsync is what Roblox expects you to use for chat messages. In short, it takes three arguments. These arguments are, (the string, player who the string is from, player who the string is to).
What you'll want to do is run the unfiltered chat message to a server-script (since FilterStringAsync from LocalScripts is deprecated).
.Chatted:Connect(function(Message)
game:GetService("ReplicatedStorage").RemoteEvent:FireServer(Message)
end)
You will then catch the message on the server's end, and iterate between each player and return it to the respective client.
.OnServerEvent:Connect(function(From, String)
for _,v in pairs(game:GetService("Players"):GetPlayers()) do
local FilteredString = game:GetService("Chat"):FilterStringAsync(String, From, v)
ReplicatedStorage.RemoteEvent:FireClient(v, FilteredString)
end
end)
You then catch the filtered string on the client, and use it as you want. In this case run it to your custom chat or whatever.
2 comments
0
ty
0
Or you could do FilterStringForBroadcast + FireAllClients
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
:FilterStringAsync or something like that, I forgot
if your making a bubble chat, why not just enable it from studios?