Deleting a specific message out the roblox chat

I want to achieve something that will delete the words that are on a blacklist out of the roblox in-game chat, the problems are:
1) I don’t know if this is going work.
2) It keeps telling me that " Chat " is not a vaild member of PlayerGui
grafik

I have already tried using a modulescript inside of the chat service with:
:RemoveLastMessageFromChannel() but it doesn’t behave the way i want it to, regarding to that i’ve already made a post.

This is currently what i have inside of a Server script:

local BlacklistedWords = {
	"word1","word2","word3"
}

game.Players.PlayerAdded:Connect(function(Player)
	while wait() do
		for i,Child in pairs(Player.PlayerGui.Chat.Frame.ChatChannelParentFrame.Frame_MessageLogDisplay.Scroller:GetChildren()) do
			for i,Child in pairs(Child:GetChildren()) do
				for i,v in pairs(BlacklistedWords) do
					if Child.Frame.Textlabel.Text == string.lower(BlacklistedWords[i]) then
						warn("Message found")
						Child.Frame:Destroy()
					end
				end
			end
		end
	end
end)
1 Like

I think this may be impossible as it is messing with the chat filter that you can be banned from Roblox for doing as some people may use it to bypass the filter.

1 Like

How is it messing with the chat filter if it is only deleting messages?

And how would people use it to bypass the chat filter?

1 Like

Yes but the chat is to do with the filter and is all linked up. When I mean bypass the chat filter is some devs may edit the chat to bypass not in the game.

1 Like

Make sure that a local script is taking care of this. The server can’t access the Chat gui, so that’s probably why you have that error. Also, I found that chat messages have a bunch of spaces in the beginning, so you will need to use something like string.find.

https://developer.roblox.com/en-us/api-reference/lua-docs/string

As for what other people are saying, just be sure to make sure that all chat gets filtered. If you’re not otherwise modifying the chat system or making your own, I don’t think you need to worry about that.

3 Likes

Even if, roblox has a service called TextService where you can use FilterStringAsync(), i don’t see a reason why it would be against their tos

2 Likes

I will try out a solution for this, thanks

1 Like

People just sometimes abuse the chat filter by editing it a little but I guess it’s not/

1 Like