Change of command

How can I make a change teams?
I tried this:

[lua]function ChangeMyTeam( ply, cmd, args )
local oldTeam = ply:Team()
GAMEMODE:PlayerOnChangeTeam(ply, “Spy”, oldTeam)

concommand.Add( “set_team”, ChangeMyTeam )[/lua]

] set_team

[ERROR] lua/autorun/client/team.lua:3: attempt to call method ‘SetTeam’ (a nil value)

  1. unknown - lua/autorun/client/team.lua:3
  2. unknown - lua/includes/modules/concommand.lua:54


teams are serverside not clientside.

if serverside then

Unknown command: set_team

Where are you putting the code?

also, Player:SetTeam() takes a number as the first argument, not a string.

Place this function in init.lua or any serverside file. In lua/autorun/server

[editline]23rd April 2015[/editline]

Yes, like James said use the Team Number ( First argument in team.SetUp() )