Why is my text not being filtered properly?

Hey there! I’m making a custom chat system, and I am trying to filter text user the Chat service. The problem is, is that it doesn’t filter anything.

Here’s the server code (in StarterGui):

local chatService = game:GetService("Chat")

script.Parent:WaitForChild("FilterFunction").OnServerInvoke = function(player, message)
	local filteredText = chatService:FilterStringForBroadcast(message, player)
	task.wait(.1)
	print(filteredText)
	return filteredText
end

And here’s the client code (in StarterGui):

local filteredText = script.Parent.FilterFunction:InvokeServer(inputBox.Text)
textChatService.TextChannels.RBXGeneral:SendAsync(filteredText)
inputBox.Text = ""

How would I filter the text? Any help is appreciated!

Is the server code in starterGui or ServerScriptService?

1 Like

As far I know message filtering isn’t working in Studio. You have to publish the game.

1 Like

It is in StarterGui.

-characters-

Server Side scripts shouldnt be in the starterGui, put the script in ServerScriptService and it should work, although maybe not depending on if it needs publishing like mentioned above

I did that and it didn’t seem to work. Is it something with the RemoteFunction? The game is published.

1 Like