Init.lua - Error help

I get this lua error when I start my gamemode, I can’t seem to identify the problem, could anyone help a Lua noob out? :slight_smile:

Error:


[gamemodes\deathmatch\gamemode\init.lua:39] 'end' expected (to close 'function' at line 12) near '<eof>'
[cpp]
There was a problem opening the gamemode file 'deathMatch/gamemode/init.lua'

init.lua
[lua]AddCSLuaFile( “cl_init.lua” ) --Tell the server that the client needs to download cl_init.lua
AddCSLuaFile( “shared.lua” ) --Tell the server that the client needs to download shared.lua

include( ‘shared.lua’ ) --Tell the server to load shared.lua

function GM:PlayerInitialSpawn( ply ) --“When the player first joins the server and spawns” function

ply:ConCommand( "team_menu" ) --Run the console command when the player first spawns

end --End the “when player first joins server and spawn” function

function GM:PlayerLoadout( ply ) --Weapon/ammo/item function

ply:StripWeapons() -- This command strips all weapons from the player.

if ply:Team() == 1 then --If player team equals 1
	ply:Give( "weapon_physcannon" ) --Give them the Gravity Gun

if ply:Team() == 2 then --If player team equals 2
	ply:Give( "weapon_physcannon" ) --Give them the Gravity Gun

end --Here we end the if condition

end --Here we end the Loadout function

function team_russia( ply )

ply:SetTeam( 1 )
	ply:Spawn()

end

function team_usa( ply )

ply:SetTeam( 2 )
	ply:Spawn()

end

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

And sorry but how do I wrap my text in a lua box in a post?

Use [lua] tags.

You also forgot to end the if condition “if ply:Team() == 1 then”. Either add an end, or replace the following if with an elseif.

That fixed it, thank you very much, I appreciate your help. :slight_smile: