I'm making a custom chat, but my text filtering isn't working. What am I doing wrong? Code:

local filteredText
local filteredString

local stringValue = Instance.new("StringValue")
stringValue.Parent = msgContainer

local success, errorMsg = pcall(function()
	filteredText = TextService:FilterStringAsync(msg, plr.UserId)
end)
	
	if success then
		local success2, errorMsg2 = pcall(function()
		filteredString = filteredText:GetNonChatStringForBroadcastAsync()
	end)
		
	if success2 then
		stringValue.Value = plr.Name..": "..filteredString
	else
		
		warn(errorMsg)
		stringValue:Destroy()
		
	end
	
else
		
	warn(errorMsg)
	stringValue:Destroy()
		
end

print(stringValue.Value)
	

Some parts have been edited out, so as to only show the filtering. I think you can get what some of these variables mean. Thanks!

EDIT: No errors, but when I type strings that should be filtered such as numbers, it doesn't filter.

1 comment

0

Which part doesn't work?