Chat filter not working

I am making a custom chat UI in my game, but the filtering script does not actually filter anything. I am not getting any errors.

SCRIPT:

local function filterText(textt, playeruserid)
			local TSs = game:GetService("TextService")
			local filterText0 =  TSs:FilterStringAsync(textt, playeruserid, 1)
			local actualTexttT = filterText0:GetChatForUserAsync(playeruserid)
			return actualTexttT
end

(This script is also run on the server)

Any help would be greatly appreciated!!

1 Like

Note: If you are playing in Studio, the filter will not work; try below script and publish to ROBLOX. Let me know when it works :slight_smile:

2 Likes
local TS = game:GetService("TextService")

local function filterText(Text, UserId)
	local TextFilter =  TS:FilterStringAsync(Text, UserId)
	local FilteredString = TextFilter:GetChatForUserAsync(UserId)
	print(FilteredString)
	return FilteredString
end