Help Gamemode code [ERROR] gamemodes/teamdeathmatch/gamemode/init.lua:27: function arguments expected ne

Need help with this code. :v:

[ERROR] gamemodes/teamdeathmatch/gamemode/init.lua:27: function arguments expected near ‘ply’

AddCSLuaFile(“cl_init.lua”)
AddCSLuaFile(“shared.lua”)

include(“shared.lua”)
include(“player.lua”)

function GM:PlayerConnect( name, ip )
print("Player " … name … “, has joined the game.”)
end

function GM:PlayerInitialSpawn( ply )
ply:SetWalkSpeed( 225 )
ply:SetGamemodeTeam()
ply:SetRunSpeed( 270 )
end

function GM:PlayerSpawn( ply )
ply:GiveGamemodeWeapons()
ply:SetModel(“models/player/swat.mdl”)
end

function changeteam( ply, text, public )
if( string.sub( text, 1, 20) == “!changeteam” ) then
if ply:Team() == 1 then
ply:SetTeam(0)
ply:KillSilent
ply:Spawn()
elseif ply:Team() == 0 then
ply:SetTeam(1)
ply:KillSilent()
ply:Spawn()
end
end
hook.Add( “PlayerSay”, “changeteam”, “changeteam” )

ply:KillSilent() not ply:KillSilent

Yeah I did it but the command doesnt work but it runs fine

Untested.

[lua]
local cmd = “!changeteam”

local function ChangeTeam( pl, txt, pub )
if( txt:Left( cmd:len() ) == cmd ) then
if( pl:Team() == 1 ) then
pl:SetTeam( 0 );
pl:KillSilent();
pl:Spawn();
else
pl:SetTeam( 1 );
pl:KillSilent();
pl:Spawn();
end
end
end
hook.Add( “PlayerSay”, “ChangeTeam”, ChangeTeam );
[/lua]