What do you want to achieve?
I want to detect when a player types /help or /? in chat.
What is the issue?
The methods for detecting chat messages that I have found so far simply return nothing.
What solutions have you tried so far?
.Chatted has worked previously, but now no longer does. I’ve attempted both the old and new events for message detection on the client, but neither have worked so far.
local Players = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")
-- neither returns anything for /help or /?
Players.LocalPlayer.Chatted:Connect(function(msg) print(msg) end)
TextChatService.SendingMessage:Connect(function(msg) print(msg) end)
is a reserved command that is specifically only accessible by the roblox engine thingy or server
there is no way a client can change it that’s why it is not detectable.
you need to implement custom commands for that
or
use TextChatService’s OnIncomingMessage or OnIncomingMessageFiltered but this still would probably not works on some…
another way is just make a new GUI message system but that’s a hassle
You are correct. OnIncomingMessage does indeed work:
local TextChatService = game:GetService("TextChatService")
TextChatService.OnIncomingMessage = function(msg)
if string.sub(msg.Text, 1, 34) == "These are the basic chat commands:" then return end
--your behavior here
end