Help with code

Well im working on admin commands to help with coding and I am running in to an error


local function chatCommand( ply, text, public )
	if (string.sub(text, 1, 9) == "/spectate") then
		 ply.StartedSpecPos = ply:GetPos()
		 ply.TheWeapons = {}
         for id, wep in pairs( ply:GetWeapons() ) do table.insert( ply.TheWeapons, wep:GetClass() ) end
		 ply:StripWeapons()
		 ply:Spectate(OBS_MODE_ROAMING)
         return(false)
    end
    if (string.sub(text, 1, 11) == "/unspectate") then
         ply:UnSpectate()
		 ply:SetPos( ply.StartedSpecPos )
		 for k,v in pairs( ply.TheWeapons ) do ply:Give( v ) end
		return(false)
    end
	if (string.sub(text, 1, 7) == "!freeze") then
		for k, v in pairs( player.GetAll() ) do
		v:Freeze( true )
		return(false)
	end
	if (string.sub(text, 1, 9) == "!unfreeze") then
		for k, v in pairs( player.GetAll() ) do
		v:Freeze( false )
		return(false)
	end
	if (string.sub(text, 1 ,7) == "!slowmo") then
		game.SetTimeScale(0.1)
		return(false)
	end
	if (string.sub(text, 1 ,9) == "!unslowmo") then
		game.SetTimeScale (1)
		return(false)
	end
	if (string.sub(text, 1, 4) == "!kill") then
		for k, v in pairs( player.GetAll() ) do
		v:Kill()
		return(false)
	end
end
hook.Add( "PlayerSay", "chatCommand", chatCommand );

that is the code the error is
[ERROR] lua/first.lua:34: ‘)’ expected near ‘1’

  1. unknown - lua/first.lua:0

What line is 34?

On unrelated note, you can do “return false” instead of “return(false)”.

[lua]
if (string.sub(text, 1, 7) == “!freeze”) then
for k, v in pairs( player.GetAll() ) do
v:Freeze( true )
return(false)
end
[/lua]

You’re not ending your loops. End your loops for your freeze, unfreeze and kills commands.

e.g

[lua]
if (string.sub(text, 1, 7) == “!freeze”) then
for k, v in pairs( player.GetAll() ) do
v:Freeze( true )
end
return false
end
[/lua]

Notice I added “end” to the example.

According to my Notepad++, it says its


	if (string.sub(text, 1, 4) == "!kill") then 

http://puu.sh/9iQI9/c96d7bbc05.png

what he said is right thats line 34

Do what Alig said and then do this:
Change


if (string.sub(text, 1, 4) == "!kill") then

to


if (string.sub(text, 1, 5) == "!kill") then

As it wont work if it was 4.