What do you want to achieve?
So I want to learn Text Service , I been reading it from developer forum .
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 .
regexman
(reg)
November 21, 2021, 11:11am
#2
local filtered = TextService:FilterStringAsync("urstring",plr.UserId)
-- were not stupid, it will always return "instance" so,
filtered:GetChatFromUserAsync(plr.UserId)
Hope this is helpful.
Qin2007
(Qin2007)
November 21, 2021, 11:47am
#3
https://developer.roblox.com/en-us/api-reference/function/TextService/FilterStringAsync
This is episode one of a tutorial series I am creating! This is my first time doing something like this so please provide additional suggestions and feedback on this tutorial.
[Img]
Fonts used:
Coolvetica
Cascadia Mono
Find the official Roblox Documentation for Text Filtering here
All important things are highlighed in blue . You can click blue text to find the official Documentation about something.
Chapter 1: Why & When?
Text filtering should always be used when user input is sent to…
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)
regexman
(reg)
November 22, 2021, 12:16pm
#5
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 .
regexman
(reg)
November 25, 2021, 10:52am
#7
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