I would like messages starting with the “-” symbol to be invisible to all players in the chat, allowing me to create commands without broadcasting them to everyone.
What is the problem?
I am unable to achieve the desired result.
What solutions have you tried?
I checked the Developer Center for potential solutions, but I couldn’t find any relevant information.
Thank you for considering my request. I look forward to any assistance!
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if msg:sub(1, 1) == "-" then
-- Delete message code
end
end)
end)
To my knowledge, I’m pretty sure you can’t delete a message in the default-chatbox. You’d have to make your own custom chatbox in order to delete past messages.
local generalChannel: TextChannel = TextChatService:WaitForChild("TextChannels").RBXGeneral
generalChannel.ShouldDeliverCallback = function(message, textChatSource)
if message.Text:sub(1, 1) == "-" then
return false
end
return true
end