Chat Filtering Always returns 'Instance'

I am trying to filter text for custom npc names.

But, TextService:FiltterStringAsync(text, fromPlayerId) alway returns ‘Instance’, even if text is a direct string. I’ve tried it in a script in Studio, Studio’s command bar and the console command bar in game, but it always returns ‘Instance’.

This is the code I used in the script:

wait(2)
local TextService = game:GetService("TextService")

local filteredText = ""
local success, errorMessage = pcall(function()
	filteredTextResult = TextService:FilterStringAsync("lmao, discord is so epik", 287113233)
end)

if not success then
	warn("Error filtering text:", text, ":", errorMessage)
	-- Put code here to handle filter failure
end

print(filteredTextResult)

Which I sourced from Text Filtering | Roblox Creator Documentation and this is the code I used in the command bars:

print(game:GetService("TextService"):FilterStringAsync("lmao, discord is so epik", 287113233))

This is my first time posting on the devforum, so I’m sorry if I have done something wrong.

Yes, it returns an instance, I don’t know why. You then have to use on of several methods to get a string:

i.e.

print(game:GetService("TextService"):FilterStringAsync("lmao, discord is so epik", 287113233):GetNonChatStringForUserAsync(287113233))

That works, thank you so much!

Just a note to anyone who is looking at this topic from a later date: this only works in-game, it won’t work in Studio. In a game you own, type /console in chat, then press ‘Server’ then paste the code into the command bar to test it out without publishing,