To keep things simple, I’ve modified the ROBLOX default ChatModules (with proximity chat and anonymous chatter) to give my game a more roleplay feel. I’ve already added /do and /me commands, but there’s one issue that needs to be addressed.
So this is my current setup:
It does everything as intended, but it shows the '/me ’ string in the bubblechat, which is the reverse of what I wanted. I tried multiple approaches, but nothing came to mind.
I would recommend changing the MessageSender module inside the Chat service. It’s located in Chat > ChatScript > ChatMain > MessageSender
You can use string.find and if it finds /me inside the message, it returns false before it fires the SayMessageRequest. I think this is what you’re looking for, maybe not. This does stop it from sending in both the bubble chat and chatbox but it seems that is what you want. I did some testing by adding a .Chatted event to myself and it seems the chat still goes through, it just doesn’t appear. Here is the code I used for testing inside the MessageSender module.
-- // FileName: MessageSender.lua
-- // Written by: Xsitsu
-- // Description: Module to centralize sending message functionality.
local module = {}
--////////////////////////////// Include
--//////////////////////////////////////
local modulesFolder = script.Parent
--////////////////////////////// Methods
--//////////////////////////////////////
local methods = {}
methods.__index = methods
function methods:SendMessage(message, toChannel)
if string.find(message, "/me") then
return false
end
self.SayMessageRequest:FireServer(message, toChannel)
end
function methods:RegisterSayMessageFunction(func)
self.SayMessageRequest = func
end
--///////////////////////// Constructors
--//////////////////////////////////////
function module.new()
local obj = setmetatable({}, methods)
obj.SayMessageRequest = nil
return obj
end
return module.new()
Hmm weird, I wonder why. It seems it still sends the chat connection so it should be able to read the chat and send the message in the chat. I will look a little more into it and see if I can figure out another solution or how to fix that issue but I don’t mess with chat too much, so I don’t know a lot about it.
Thank you, very appreciated, I think the main thing would be to edit the bubble chat script and prevent creating a bubble chat if the string finds '/me '.
Alright I think I found what you need to change. It’s under the local script BubbleChat in Chat Service. Go ahead and use ctrl + f to find the function this:OnPlayerChatMessage(sourcePlayer, message, targetPlayer)
Change that function to the given code below. It seems to stop the message from sending in bubble chat, but still sends in the chat box.
function this:OnPlayerChatMessage(sourcePlayer, message, targetPlayer)
if not this:BubbleChatEnabled() or string.find(message, "/me") then return end
local localPlayer = PlayersService.LocalPlayer
local fromOthers = localPlayer ~= nil and sourcePlayer ~= localPlayer
local safeMessage = this:SanitizeChatLine(message)
local line = createPlayerChatLine(sourcePlayer, safeMessage, not fromOthers)
if sourcePlayer and line.Origin then
local fifo = this.CharacterSortedMsg:Get(line.Origin).Fifo
fifo:PushBack(line)
--Game chat (badges) won't show up here
this:CreateChatLineRender(sourcePlayer.Character, line, true, fifo, false)
end
end```
Yes, all identical. Have you got module.AllowMeCommand = true in the ChatSettings script?
Because /me messages don’t get triggered in the OnPlayerChatMessage.
Yeah, I just enabled it. Maybe I don’t fully understand what your problem is because of the editing you have done to the modules. Chatting back and forth on this is just a bit hard. It seems if you have AllowMeCommand set to true, it automatically doesn’t show the /me in bubble chat.