Roblox has a lot of tags in the game, but when you create a chat gui, it has to still adhere to the chat rules.

I'm not sure how I would do this in the actual game, because when I add a chat gui, nothing gets censored.

I don't know how I would do this in a few lines, what I'm thinking of (probably not a good idea), is to add key letters into a table, and then when the message is sent, it checks whether it matches anything in the table. Something a bit like this:

local tags = {} --tags are simply words i need to censor, i didnt put anything in the table there because its just an example

game.ReplicatedStorage.ChatEvent.Event:Connect(function(msg) --a random bindable event
	if table.find(tags, msg) then --if it finds the message in the table tags
		msg = string.rep("#",string.len(msg)) --adds a # for each character in the message.
	end
end)

thats just a quick example, nothing im actually doing, but is there a much simpler way (since my way is not reliable) I can add a chat filter?

3 comments

0

You can use TextService:FilterStringForBroadcast() or you can use the retro filter function that is similar with game:GetService("Chat"). You can find more approaches by reading up on these Services. Also, msg by default is a String Object, meaning all base-class methods are inherited automatically; msg:rep('#',msg:len()).

0

You can use TextService's FilterStringAsync(). I posted an answer on a different question here, https://scriptinghelpers.org/questions/95354/what-do-the-filterstringasync-parameters-mean#88091

0

ok, ill look into those.