Overriding player chat, clientside

I know this can be done easily with PlayerSay serverside, but I need to do this for the local player clientside.

For example:

  • The player says “hello”, this is said normally
  • The player says “/hello”, and the text is intercepted and redirected to a concommand called say_2

I’ve done this before with ChatTextChanged, but it was a bit rubbishy, and would only send it once you stuck a suffix on the end of the text (e.g. “hello!@@@” without you even pressing enter.

Any ideas?

OnPlayerChat

Will returning false to override work?

Edit: I need to intercept the local player’s chat, to stop it being sent to the server

It’ll still get sent. Not quite sure how you would intercept it before it gets sent.