Hello, I am making a chat system. It all works just fine, but when I try to filter the message a player sends it doesn’t work. Here’s an example video:
Here’s my code:
local players = game:GetService("Players");
players.PlayerAdded:Connect(function(player)
if player ~= nil then
player.Chatted:Connect(function(message, recipent)
local replicatedStorage = game:GetService("ReplicatedStorage");
for _, v in ipairs(players:GetChildren()) do
local example = v.PlayerGui.Chat.Chat.Example;
local exampleClone = example:Clone();
exampleClone.Parent = example.Parent
example.Parent.CanvasPosition = example.Parent.CanvasPosition + Vector2.new(0, 10)
local chatService = game:GetService("Chat")
local filteredText = chatService:FilterStringForBroadcast(message, player)
exampleClone.Text = "[".. player.Name.. "]: ".. tostring(filteredText)
end
end)
end
end)
Any help?