Try this:
[lua]include( ‘shared.lua’ )
include( ‘cl_scoreboard.lua’ )
include( ‘cl_hud.lua’ )
// Clientside only stuff goes here
–Set Team Menu Start
function set_team()
if SERVER then return end
local frame = vgui.Create( "DFrame" )
frame:SetPos( 100, ScrH() / 2 )
frame:SetSize( 200, 210 ) //Set the size
frame:SetTitle( "Select Team" ) //Set title
frame:SetVisible( true )
frame:SetDraggable( false )
frame:ShowCloseButton( true )
frame:MakePopup()
team_1 = vgui.Create( "DButton", frame )
team_1:SetPos( 30, 30 )
team_1:SetSize( 100, 50 )
team_1:SetText( "Team Red" )
team_1.DoClick = function() //Make the player join team 1
RunConsoleCommand( "team_1" )
end
team_2 = vgui.Create( "DButton", frame )
team_2:SetPos( 30, 85 ) //Place it next to our previous one
team_2:SetSize( 100, 50 )
team_2:SetText( "Team Blue" )
team_2.DoClick = function() //Make the player join team 2
RunConsoleCommand( "team_2" )
end
team_3 = vgui.Create( "DButton", frame )
team_3:SetPos( 30, 140 ) //Place it next to our previous one
team_3:SetSize( 100, 50 )
team_3:SetText( "Spectator" )
team_3.DoClick = function() //Make the player join team 3
RunConsoleCommand( "team_3" )
end
end
concommand.Add( “team_menu”, set_team )
–Set Team Menu End[/lua]
If that fails (Which it really shouldn’t), put
[lua]local vgui = vgui[/lua]
That is probably futile, but in the end it would speed up the running speed of the code by tiny amount - although you shouldn’t be getting nil vgui errors on the client in the first place.