EDIT - I’ve been able to fix this with help from here. Thanks guys.
Hello. I am making a simple game mode and have encountered a problem. The client cannot execute a concommand in shared.lua . I have looked for solutions in several places.
When I try to execute team_1 or team_2 in console it says this:
] team_1 Test\gamemode\shared.lua:14: attempt to call method 'SetTeam' (a nil value) ] team_2 Test\gamemode\shared.lua:23: attempt to call method 'SetTeam' (a nil value)
Here is my code from shared.lua :
GM.Name = "Test" GM.Author = "Jakfrost944" GM.Email = "N/A" GM.Website = "N/A" DeriveGamemode( "sandbox" ) team.SetUp( 1, "Player", Color( 125, 125, 125, 225 ) ) team.SetUp( 2, "Juggernaut", Color( 225, 225, 225, 225) ) function team1( ply ) ply:SetTeam( 1 ) ply:Spawn() end concommand.Add( "team_1", team1 ) function team2( ply ) ply:SetTeam( 2 ) ply:Spawn() end concommand.Add( "team_2", team2 )
Here are the wiki pages for concommand.Add() and player.SetTeam() :