Making A Similar Chat Filter To The Roblox One

Hello Scripters.

Recently Some Other Admin Kicked The Owner Of The Game For No Reason.
And It Features A Swear Word Which I Wont Say Here.

And I Want A Similar Chat Filter To Roblox.
Thanks For Coming In

1 Like

Try use the Filtering from the TextService

local text = script.Parent.Text -- as a example
local userID = script.Parent.Parent.USID.Text -- as a example
local filteringresult = game:GetService("TextService"):FilterStringAsync(text, userID)
print(filteringresult)
1 Like

i mean your script does work but i wanted like an example like

local text = "Text Here"

Hello, not sure what you mean by an example. But I made the function to filter the chat system.
If you want a chat filter then you’ll need to use remote events however this is just an example!

Keep in mind this only works on a server script.

local TextService = game:GetService("TextService")
local Players = game:GetService("Players")

local function FilterString(String, UserId)
	local Text = TextService:FilterStringAsync(String, UserId)
	
	return Text
end

Players.PlayerAdded:Connect(function(Player)
	local Text = FilterString("Hello world!", Player.UserId)
	
	print(Text)
end)
2 Likes

it prints TextFilterResult?

very weird

1 Like

Hello, thanks for bringing this to my attention. I accidentally forgot to put :GetNonChatStringForBroadcastAsync(), anyways here’s the updated code:

Keep in mind chat doesn’t filter in studio, either join team test or the Roblox version of the game!

local TextService = game:GetService("TextService")
local Players = game:GetService("Players")

local function FilterString(String, UserId)
	local Text = TextService:FilterStringAsync(String, UserId):GetNonChatStringForBroadcastAsync()

	return Text
end

Players.PlayerAdded:Connect(function(Player)
	local Text = FilterString("Hello world!", Player.UserId)

	print(Text)
end)