Filtering text on ui

Hello. I am using free models in my game and want to make sure the text on the ui is filtered so I dont get a warning/ban.

How can I do this quickly?

I looked this up and found nothing.

Any way to do this?

Use TextService: TextService documentation

In your case, use FilterStringAsync

Don’t sure I understand the doc.

Try this: Text and Chat Filtering

local TextService = game:GetService("TextService")

local function filterText(Text, UserId)
	local success, result = pcall(function()
		return TextService:FilterStringAsync(Text, UserId)
	end)
	if success and result then
		return result:GetNonChatStringForBroadcastAsync()
	end
end

Uh, what does this script do???

What it does is filter the text when the filterText function is called.

So I can just put this in workspace and all text thatis not filtered will be filter when the game runs?

Why do you need to add an argument named UserId? this seems useless.

Edit: I just read the article, its a vital argument :sweat_smile:

Is the script he made do what I said?

No, you should make a module you can call to filter text.
A module is script that contains functions that can be called from other scripts.

I really know nothing at all about scripting, ig I will take a risk I dont think any of it is unfiltered anyways.

No, you must call the function and provide a text to be filtered and a UserId. It is only needed when you have no control over the text that is displayed.
For example: Player A sends a message > Filter the text and then show it to all players.

Ok!! So are roblox textbox’s pre filtered?

You should read the documentation, Luau is one of the most easiest languages to learn, and besides, down the road, youre obviously gonna need some sort of skill later on in life. Glancing through the article will not teach you anything.

I understand that but just so I know are roblox textbox’s pre filtered?

Nope, but this would be a pretty nice feature.