So I'm in the process of making a custom chat GUI for my game. Of course, in order to prevent my game from being shut down, it must be done with ROBLOX's filters, so I have to use FilterStringAsync. The way I chose to accomplish this was by having a folder named "ChatStorage" being placed in the Workspace and a script where whenever a player chats, it creats a StringValue with the name of it as the player who chatted and the value as what the player said that is parented to the ChatStorage.
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(message)
local stringVal = Instance.new("StringValue", game.Workspace.ChatStorage)
stringVal.Name = player.Name
stringVal.Value = message
end)
end)
A LocalScript is in the PlayerGui and it fires whenever a child is added to the ChatStorage. This is the main script; it's where the FilterStringAsync function takes place and where the player's message is scripted to appear from. However, when all of this is ran, I get absolutely no output whatsoever. Nothing is added to the ChatBox, where the messages are supposed to appear, and when I check inside of the Developer Console in the actual game, I still see nothing outputting.
local ChatService = game:GetService("Chat")
cb1 = script.Parent.cb1 --These are the names of the 8 chatboxes in the Chat GUI.
cb2 = script.Parent.cb2
cb3 = script.Parent.cb3
cb4 = script.Parent.cb4
cb5 = script.Parent.cb5
cb6 = script.Parent.cb6
cb7 = script.Parent.cb7
cb8 = script.Parent.cb8
game.Workspace.ChatStorage.ChildAdded:connect(function(child) --When a new child is added to the aforementioned ChatStorage, this fires.
if (child:IsA("StringValue")) == true then --Checking to see if it's an actual message.
local message = child.Value --Setting the message.
local sender = child.Name --Setting the sender.
local player = game.Players.LocalPlayer --Setting the receiver.
local filteredMessage = ChatService:FilterStringAsync(message, sender, player.Name) --Setting the FilterStringAsync function.
print(filteredMessage) --I tried printing it and I got no output.
cb1.Text = cb2.Text --This is just for moving the messages up after every entered message.
cb1.TextColor3 = cb2.TextColor3
cb2.Text = cb3.Text
cb2.TextColor3 = cb3.TextColor3
cb3.Text = cb4.Text
cb3.TextColor3 = cb4.TextColor3
cb4.Text = cb5.Text
cb4.TextColor3 = cb5.TextColor3
cb5.Text = cb6.Text
cb5.TextColor3 = cb6.TextColor3
cb6.Text = cb7.Text
cb6.TextColor3 = cb7.TextColor3
cb7.Text = cb8.Text
cb7.TextColor3 = cb8.TextColor3
if sender.Name == "8391ice" then --If it's my name, I get a cool Owner tag and a red-colored message :P
cb8.Text = "[Owner] 8391ice: " ..filteredMessage
cb8.TextColor3 = Color3.new(1, 0, 0)
elseif sender.Name == "Server" then --If it's a message like a player leaving or entering, the Server says it and it gets a tan-colored message.
cb8.Text = "[Server:] " ..filteredMessage
cb8.TextColor3 = Color3.new(1, 1, 127/255)
else --Anything else is just assumed to be a player, and he or she is given white text.
cb8.Text = sender.. ": " ..filteredMessage --Message is set to the filtered message.
cb8.TextColor3 = Color3.new(1, 1, 1)
end
end
wait(.1)
end)
Do any of you think you might be able to spot what's wrong with this script? I'm just completely stuck right now and I have nowhere else to turn but ScriptingHelpers. Thanks!

1 comment
According to the wiki, you need to use the actual player object instead of their name for both the sender and the receiver.