Player.Chatted function does not work on LocalScript

repeat wait()
	print('Game not loading')
until

game:IsLoaded() == true

local Players = game:GetService('Players')
local Player = Players.LocalPlayer

local Remote = game.ReplicatedStorage.Remotes.ExecuteCommand

local Commands = {
	"/re",
	"/dummy",
	"/r6",
	"r15",
	"/rmap",
	"/run"
}

Player.Chatted:Connect(function(msg)
	msg:lower()
	print(msg)
	
	if msg == Commands[1]:lower() then
		Remote:FireServer("RespawnCharacter")
	end	
	
	if msg:split(" ")[1]:lower() == Commands[2]:lower() then
		
		if msg:split(" ")[2]:lower() == "r6" then
			Remote:FireServer("R6_Dummy")
		end
		if msg:split(" ")[2]:lower() == "r15" then
			Remote:FireServer("R15_Dummy")
		end

	end
	
	if msg:split(" ")[1]:lower() == Commands[6] then
		for i = 2,#msg:split(" ") do
			
			game.ReplicatedStorage.Remotes.RunCode:FireServer(
				msg[i],
				game.Players.LocalPlayer.Name
			)
			
		end
	end
	
	if msg:lower() == Commands[5] then
		
		Remote:FireServer("RESET_MAP_FUNCTION")
		
	end
	
end)

Everything was working PERFECTLY but for some reason now it broke. It doesn’t even print the player message. Can anyone help me?

You are using the TextChatService or the legacy chat?

1 Like

Yes, I am using TextChatService

Player.Chatted only works with LegacyChatService I’m not sure why it doesn’t work with TextChatService

If you want to use the TextChatService to handle when a player chatted, check the documentation of the new default TextChatService. Chatted only works with the previous one, the legacy one

IncomingMessage

Check the announcement too if you want to:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.