I’d say sting.Left would be better when checking for chat commands.
Also, they way I like to check for commands is like this:
hook.Add(“PlayerSay”, “checkcommands”, function( ply, said )
if string.Left( said, 1 ) == “!” then
local split = string.Split(said, " " )
local firstword = split
local command = string.sub( firstword, 2, string.len( firstword ) )
– Now you can do some ifs with command, eg
if command == “warden” then
– It’s a good idea to return false on commands too in my opinion
– A lot clearner chat
Means you don’t have to string sub evertime, because command is always the first word, minus the ‘!’
Of course, if you don’t plan to check for other commands, simple string.sub would be adequate.
This way is useful if you want to check a few commands, and don’t have to redo subs all the time.