Is there any way to "block" a chat message using the new chat?

So, basically I want to stop messages from being sent only if they meet a requirement to not be sent.

I already have this figured out, what I need help with is actually blocking the message.

While searching for solutions, I found a post about Chat:RegisterChatCallback() which I tried, and I couldn’t get it to work.

function CheckMessage(Message)
	local Blacklisted = false
	-- non-important code removed
	if Blacklisted then
		Message.ShouldDeliver = false
	return Message

Chat:RegisterChatCallback(Enum.ChatCallbackType.OnServerReceivingMessage, CheckMessage)

Note, the print(Message) doesn’t even get activated.

Is there a new way to do this, and if so how can I do it?

1 Like

The Equivalent of RegisterChatCallback for TextChatService is OnIncomingMessage

game.TextChatService.OnIncomingMessage = function(message)
	message.Status = Enum.TextChatMessageStatus.InvalidTextChannelPermissions

1 Like

I tried using that, and the “message” variable in the function printed as nil, I may have implemented it incorrectly though.

Could you put the code for your implementation so we can fix the bug?

1 Like

I got it to work, I was correct about me implementing it incorrectly initially.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.