PlayerSay not working?

I’m currently having an issue in my gamemode. It’s really strange because I have been coding for over 4 years in Lua and never had this issue. Currently I have noticed that GM13 sometimes has issues that GM12 did not, obviously.

But for some reason if I do a hook or even override the function PlayerSay I cannot get it to work.

Anyone have any ideas as to why this function isn’t being called?

I have tried MsgN(“test”) at the top of the function to see if it was even getting called and no output was displayed in the console.

This is in my init.lua file of my gamemode. There are no errors.

Any help will be greatly appreciated. Thank you Facepunch users.

Where do you have this code? Are there any errors?

Already answered.

try running ServerLog without self:

Not sure if that will fix it, but worth a shot.

ServerLog is overwritten in my gamemode. I’ve tried commenting it out.

I quickly made up something like yours and it worked fine to me so I’m guessing its something to do with your overwriting part?


function GM:PlayerSay(ply, text, tOnly)
  if tOnly then 
	ServerLog(ply:Nick() .. " says (TEAM) " .. text)
	else
	ServerLog(ply:Nick() .. " says " .. text)
	end
  return text
end

Did you check if the function was overwritten.

I wrote a function GM:ServerLog(txt). That’s why I’m using it. It logs to a file and prints to console. It runs fine throughout the rest of my gamemode.

No matter what I do to the PlayerSay hook(override or hook.Add), I cannot get it to run. There are absolutely no errors/warnings.

What do you mean?

I meant to say function sorry.

You were absolutely right. It happened to be an addon that was overwriting it. Removed and fixed. Thanks!