You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
im attempting to making a console chat for my game, and of course i want the msg’s to be filtered - What is the issue? Include screenshots / videos if possible!
for some reason when filtering it, it returns nothing
- is with filtering
- isnt
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
ive tried all the filtering methods, but its not working
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Server handler
local remote = game.ReplicatedStorage:WaitForChild("Chat")
local remoteToXbox = game.ReplicatedStorage:WaitForChild("ChatToXbox")
local cantspeak = {}
remote.OnServerEvent:Connect(function(plr,msg)
if not table.find(cantspeak,plr) then
print(plr.Name.." SENT:"..msg)
local filtered = game:GetService("Chat"):FilterStringForBroadcast(msg,plr) --variable that returns nothing
remote:FireAllClients(plr,filtered)
table.insert(cantspeak,plr)
task.wait(3)
table.remove(cantspeak,table.find(cantspeak,plr))
end
end)
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg,res)
local filtered = game:GetService("Chat"):FilterStringForBroadcast(msg,plr)
remoteToXbox:FireAllClients(plr,filtered)
end)
end)
client display
game.ReplicatedStorage:WaitForChild("Chat").OnClientEvent:Connect(function(plr,msg)
local color = ("#"..tostring(ComputeNameColor(plr.Name):ToHex()))
local code = '"'
local colortext = ("<font color="..code..color..code..">"..plr.DisplayName.." (XBOX)"..": ".."</font>")
game:GetService("TextChatService").TextChannels.RBXGeneral:DisplaySystemMessage(colortext..msg)
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.