How do i make an announcement system filtered?

So , i’m trying to make this announcement system filtered , how do i do this?
Basically , an admin types something in a TextBox (script.Parent.message) and clicks the TextButton (script.Parent.d) then what he typed shows up on everyone’s screen. The only thing i need is the filter so if someone types a bad word it gets censored with hashtags.
I did some reseach but i couldn’t find anything like this.
Any help would be appreciated!

Client:

game.ReplicatedStorage.AnnounceClient.OnClientEvent:Connect(function(text)
	if game.ReplicatedStorage.time.Value <= 0 then 
		script.Parent.Text.Text = text
		script.Parent.Text:TweenPosition(UDim2.new(0.307, 0,0.122, 0),'Out','Quad',0.5,false)
		wait(5)
		script.Parent.Text:TweenPosition(UDim2.new(0.307, 0,-0.822, 0),'Out','Quad',0.5,true)
	end
end)

script.Parent.d.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.AnnounceEvent:FireServer(script.Parent.message.Text)
end)

Server:

local seconds = 300
local timee = game.ReplicatedStorage.time
game.ReplicatedStorage.AnnounceEvent.OnServerEvent:Connect(function(player,text)
	if game.ReplicatedStorage.time.Value == 0 then
		game.ReplicatedStorage.AnnounceClient:FireAllClients(text)
		wait(0.1)
		timee.Value = 300
	end
end)

while true do
	wait(1)
	if game.ReplicatedStorage.time.Value == 0 then return end
	game.ReplicatedStorage.time.Value = game.ReplicatedStorage.time.Value - 1
end

Take a look into the Chat service Filter String for Broadcast.

2 Likes

Using the ChatService filtering methods is antiquated. Please use the TextService going forward.

Furthermore, OP, you would’ve received an answer had you searched around. Please do check out the Developer Hub or is the search bar before posing a question, should your question have already been answered. See this article on Text and Chat Filtering for future filtering-based assistance.

2 Likes