FIlter Ui Text error, got instance

Hello,
I wanted to make the text of my Ui filtered but i´m always getting this error:
invalid argument #3 (string expected, got Instance)

Does anyone know how to fix it?

local text = changeValue
				local playerID = plr.UserId
				local filteredTextResult = TextService:FilterStringAsync(text,playerID)
				changeValue = filteredTextResult
				changing = Sign:FindFirstChild("TextLabel")
				changing.Text = changeValue

Is the error pointing to the

local filteredTextResult

line?

No, its pointing to the changing.Text = changeValue

Maybe check what it returns.

First thing you should do if you unsure of how a function works is to read the documentation because it’ll often have the answer you need as well as a code sample for reference. FilterStringAsync returns a TextFilterResult. You should be calling one of TextFilterResult’s methods (e.g. GetNonChatStringForBroadcastAsync) to get a string that you can set.

1 Like

I tried to do it like this now:

local text = changeValue
local playerID = plr.UserId
				
local filteredTextResult = TextService:FilterStringAsync(text,playerID)
changeValue = filteredTextResult:GetNonChatStringForBroadcastAsync()
changing = Sign:FindFirstChild("TextLabel")
changing.Text = changeValue

Its not giving any errors but also not filtering the text.
Maybe can you help me because this is all i got from that article :sweat_smile:

Text does not filter while testing in Studio mode.