Trying to delete messages sent by one person in a single script without deleting every message

Hello, I have made an admin script. I have tried to make the admin script delete commands, but everything I do just doesn’t work or deletes every message. Keep in mind that this is only ONE script. No events or anything.

game.TextChatService:WaitForChild("TextChannels").RBXGeneral.ShouldDeliverCallback = function(msg)
	if string.find(msg.Text, "/") then
		newChatted(msg.Text, msg.TextSource.Name)

		local properties = Instance.new("TextChatMessageProperties")

		msg.Text = ""
		properties.PrefixText = ""
		properties.Text = ""

		return properties
	else
		return msg
	end
end

I don’t know what I’m doing wrong.

I can’t provide code for this since I can’t remember what the exact names are, but can’t you catch the command of the admin on the client and simply never send it, and then tell the server via a remoteEvent?

(I remember seeing admin command done this way)

1 Like

Yes, that would work correctly, but I mentioned that the admin script I am making is a single script.

Thanks.

1 Like