How do I apply the chat filter on a TextLabel?

So basically I have this textlabel inside a of a surfacegui in which players can type stuff using click detector buttons, and yeah they basically can type everything, including stuff that can get my posterior banned
How do I apply a chat filter on it? Do I have to use remote events and all that or?

Each time it changes you’d have to take the new string and filter it.

You can look at the Text Filtering Doc, it may help you there!

1 Like

you can use ChatService:FilterStringForBroadcast(text, playerfrom) to filter text! it returns the text you put in as filterted text.

argument 1 - text: is where you input the text that needs to be filtered
argument 2 - playerfrom: is the player that is speaking.

say you have a textbox where people can input text, you can code something like

script.Parent.TextBox.Changed:Connect(function()
	script.Parent.TextBox.Text = game.Chat:FilterStringForBroadcast(script.Parent.TextBox.Text,game.Players.localplayer)
end)
2 Likes