Simple Gamemode Not Running Console Commands

Ok, so I made a VERY simple gamemode based off one of the lua tutorials. It works fine in single player with the choose team menu popping up on spawn. However in multiplayer on my server it just wont run that one console command to bring up the menu and I have to run the command manually in the console which works fine. Theres no lua errors so whats the problem?

Heres the init.lua:

[lua]
AddCSLuaFile( “cl_init.lua” )
AddCSLuaFile( “shared.lua” )
AddCSLuaFile( “cl_run.lua” )

include( ‘shared.lua’ )
include( ‘shared.lua’ )

function GM:PlayerSpawn( ply )

self.BaseClass:PlayerSpawn( ply )   change
									
ply:SetGravity( 1 )  
ply:SetMaxHealth( 100, true )  

ply:SetWalkSpeed( 500 )  
ply:SetRunSpeed( 600 ) 
ply:SetJumpPower( 400 )

end

function GM:PlayerInitialSpawn( ply )
joining( ply )
RunConsoleCommand( “set_team” )
end

function GM:PlayerLoadout( ply )

if ply:Team() == 1 then 

	ply:Give( "weapon_physcannon" ) 
	

elseif ply:Team() == 2 then 

	ply:Give( "weapon_physcannon" ) 
	
end 

end

function sb_team1( ply )

ply:UnSpectate()  
ply:SetTeam( 1 ) 
ply:Spawn() 

end

function sb_team2( ply )
ply:SetTeam( 2 )
ply:Spawn()

end
concommand.Add( “sb_team1”, sb_team1 )
concommand.Add( “sb_team2”, sb_team2 )

function joining( ply )

ply:Spectate( 5 ) 
ply:SetTeam( 3 ) 

end

[/lua]

and heres the cl_init.lua

[lua]
include( ‘shared.lua’ )

function set_team()

local ChooseFrame = vgui.Create( “DFrame” )
ChooseFrame:SetPos( 50,50 )
ChooseFrame:SetSize( 420, 440 )
ChooseFrame:SetTitle( “Choose Team” )
ChooseFrame:SetVisible( true )
ChooseFrame:SetDraggable( true )
ChooseFrame:ShowCloseButton( true )
ChooseFrame:MakePopup()

local BlueButton = vgui.Create( “DButton”, ChooseFrame )
BlueButton:SetText( “Team Blue” )
BlueButton:SetPos( 10, 40 )
BlueButton:SetSize( 85, 20 )
BlueButton.DoClick = function ()
RunConsoleCommand( “sb_team2” )
end

local RedButton = vgui.Create( “DButton”, ChooseFrame )
RedButton:SetText( “Team Red” )
RedButton:SetPos( 10, 70 )
RedButton:SetSize( 85, 20 )
RedButton.DoClick = function ()
RunConsoleCommand( “sb_team1” )
end

end

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

any ideas? and for the record, it happens to other players on my server and ive tried removing all my addons and gamemodes so the chances of it being a conflict are very low. I have tried a lot of things, so dont flame me.

I see a missing parenthesis missing Line 55, first Lua.

Try that.

Actually, thats not in original lua, I acidently did that when editing out comments (they were unecessary for the post)

EDIT: Its the set_team bit that isnt running on my server

Well I think I just discovered the Problem:
[lua]function GM:PlayerInitialSpawn( ply )
joining( ply )
RunConsoleCommand( “set_team” )
end[/lua]
(Thats your code, just C&P’d to distinguish it)
AFAIK InitialSpawn is only called once, that is the first time the player spawns in the server.

Edit:
You could try:
[lua]function GM:PlayerInitialSpawn( ply )
joining( ply )
ply:ConCommand( “set_team” ) --Replaced with RunConsoleCommand
end[/lua]
If you still want it to only appear once.

Well im slightly confused, surely it should run the first time I spawn though anyway?

and I will try replacing that, wish me luck.

Edit: It worked, thanks.