Team only allows one player



function Spawn( ply ) 
 function GM:TeamHasEnoughPlayers( teamid )
  local PlayerCount = team.NumPlayers( teamid )
  if ply:Team() == 1 and team.NumPlayers >1 then team.Joinable == false 
end
end
  hook.Add( "PlayerSpawn", "playerSpawn", Spawn )


Im trying to allow it so that the team can only have one player… but It is returning the error

ERROR: GAMEMODE:‘ShouldDrawLocalPlayer’ Failed: Rushing/gamemode/cl_init.lua:149: attempt to call method ‘CallClassFunction’ (a nil value)

What is going onnn D:.

First of all:
[lua]function Spawn( ply ) – 1
function GM:TeamHasEnoughPlayers( teamid ) – 2
local PlayerCount = team.NumPlayers( teamid )
if ply:Team() == 1 and team.NumPlayers >1 then team.Joinable == false – 3
end – 3
end – 2
– Where’s 1?
hook.Add( “PlayerSpawn”, “playerSpawn”, Spawn )[/lua]

You forgot an “end” here.

Second of all, the error you see there isn’t caused by this piece of code.