How To Delete A Chat Message

I made a chat command named “menu” and I can’t find a way to delete the specified message.

Code
local Players = game:GetService("Players")

local Mods = {UserId Would Go Here}

Players.PlayerAdded:Connect(function(player)
	player.Chatted:connect(function(msg)
		if msg == ";Menu" then
                        --Somehow Delete Message
			for _, v in pairs(Mods) do
				if Players:GetPlayerByUserId(v) == player then
					player.PlayerGui.Menu.Enabled= true
				end
			end
		end
	end)
end)

Thanks so much if you could help :slight_smile:

Instead of deleting the already-added message, you should check the message before sending it.

Fortunately, roblox has an event for that: In-Experience Text Chat | Roblox Creator Documentation called RegisterProcessCommandFunction

1 Like