Player.chatted not firing when /e commands are used (again)

Its not just /e, any textchatcommand is failing to fire .chatted.

All of my custom scripted commands stopped working in the last few days. I use ‘textchatcommand’ objects to hide the commands from the game chat:

if i don’t use the textchatcommand objects the commands work as expected.
but then the commands show up in the general chat and chat bubbles

The textchatcommand objects seem to be blocking the player.chatted event from firing.

The texchatcommand being triggered used to ALSO fire the Player.Chatted event. Now it does not. I think the order was changed.

before:
player chats…
player.chatted is fired
server checks if textchatcommand was triggered
message is displayed in general chat (if not a textchatcommand)

now:
player chats…
server checks if textchatcommand was triggered
player.chatted is fired (if not a textchatcommand)
message is displayed in general chat (if not a textchatcommand)

this check has been moved in the order:

I fixed mine by just converting to using the textchatcommand.triggered event, but I’m sure a lot of older games or games with no current dev support team will be broken due to this change.

one gotcha to look out for when converting is that the .triggered event doesn’t give you the player like .chatted does, it gives you the textsource object so you have to get the player to send to the function that you had used with .chatted previously:

		TextChatCommandObject.Triggered:Connect(function(textsource, message)
			local player = game.Players:FindFirstChild(textsource.Name)
			if player then
				onPlayerChatted(player, message)
			end
		end)
2 Likes