Explain FilterStringAsync From Text Service

  1. What do you want to achieve?

So I want to learn Text Service , I been reading it from developer forum .

  1. What is the issue?

The script provided by developer forum is too hard , i cant understand . So can somebody show me some example script on how to use it ?? Just a line of how to use FilterStringAsync .

local filtered = TextService:FilterStringAsync("urstring",plr.UserId)
-- were not stupid, it will always return "instance" so,
filtered:GetChatFromUserAsync(plr.UserId)

Hope this is helpful.

https://developer.roblox.com/en-us/api-reference/function/TextService/FilterStringAsync

local filterdText = game:GetService('TextService'):FilterStringAsync('hbubithein fihtbuibteg',Player.UserId)
2 Likes

so is this script correct ? its for my custom chat .

RE.OnServerEvent:Connect(function(player, msg)

   local Filtered = TextService:FilterStringAsync(msg, player.UserId)
   RE2:FireAllClients(Filtered)

end)

Yes. But it will return “instance” so do this:


filteredmessage:GetChatForUserAsync(plr.UserId)

Also, wrap it in pcalls as it can fail. Bc it makes http requests so wrap it in pcalls for filterstringasync and GetChatForUserAsync

so i should be like this ??

RE.OnServerEvent:Connect(function(player, msg)

   local Filtered = TextService:FilterStringAsync(msg, player.UserId)
   Filtered:GetChatForUserAsync(player.UserId)
   RE2:FireAllClients(Filtered)

end)

i add the pcall later .

Just a lil change, make it like

RE.OnServerEvent:Connect(function(player, msg)
   local Filtered = TextService:FilterStringAsync(msg, player.UserId)
    local actualfilter = Filtered:GetChatForUserAsync(player.UserId)
   RE2:FireAllClients(actualfilter)
end)

You need to send the one which is the GetChatForUserAsync, not FilterStringAsync.

1 Like