color error

hello, I am getting this error -
[lua]
[ERROR] gamemodes/<mygamemode>/gamemode/shared.lua:6: attempt to call global ‘color’ (a nil value)

  1. unknown - gamemodes/<mygamemode>/gamemode/shared.lua:6
  2. include - [C]:-1
    3. unknown - gamemodes/<mygamemode>/gamemode/init.lua:4
    [/lua]
    on this line of code -
    [lua]
    teams[1] = {name = “team01”, Color = Vector( 1.0, .2, .2 ), weapons = {“weapon_crowbar”} }
    [/lua]
    what do i do?

You are trying to call “color” while your table index is “Color” (Capital C)

I tried both variations

would be better if you pasted whole function, not just one line

[lua]local ply = FindMetaTable(“Player”)

local teams = {}

teams[0] = {name = “ply_runners”, Color = Vector( .2, .2, 1.0 ), weapons = {“weapon_crowbar”} }
teams[1] = {name = “ply_sniper”, Color = Vector( 1.0, .2, .2 ), weapons = {“weapon_crowbar”} }

function ply:SetGamemodeTeam( n )
if not teams[n] then return end

self:SetTeam( n )

self:SetPlayerColor( teams[n].Color )

self:Givegmodesweps()

return true

end

function ply:Givegmodesweps()
local n = self:Team()
self:StripWeapons()

for k, wep in pairs(teams[n].weapons) do
	self:Give(wep)
end

end[/lua]

[lua]local ply = FindMetaTable(“Player”)

local teams = {}

teams[0] = {name = “ply_runners”, Color = Color( .2, .2, 1.0 ), weapons = {“weapon_crowbar”} }
teams[1] = {name = “ply_sniper”, Color = Color( 1.0, .2, .2 ), weapons = {“weapon_crowbar”} }

function ply:SetGamemodeTeam( n )
if not teams[n] then return end

self:SetTeam( n )

self:SetPlayerColor( teams[n].Color )

self:Givegmodesweps()

return true
end

function ply:Givegmodesweps()
local n = self:Team()
self:StripWeapons()

for k, wep in pairs(teams[n].weapons) do
self:Give(wep)
end
end[/lua]
Try now, also use [lua] tags next time you are posting code
@Also point of note, having 2 separate functions for setting player colors and weapons is plain stupid.

I did most of this based off of a tutorial

edit: seems to have fixed it.

Tutorial on gmod wiki ?(The old one)
If so, I don’t suggest them, they are good for checking how it looks in a code and arguments, but most of these tutorials are messy and outdated.
Like that sqlite tutorial that uses NWInts for everything.

no, it was on youtube during when gmod 13 first came out.

Oh, I dunno about youtube tutorials either.
If they tell you to make 2 separate functions for things that can be handled in one function easily and with less mess then I suggest you quit them.
The best way (and I think we will all agree) is to read someone elses code, from someone who knows what he is doing. Modify their scripts and see what happens.

I’ll try, but right now everything on it is broken. it won’t even add shared.lua or cl_init.lua.