Fretta, setting variables for each time during game

I’m making a gamemode where one player can buy upgrades for his team. Unlock extra tiers of equipment, etcetera. Can anybody tell me how I’d keep track of this? Once I get storing variables down, the rest won’t be a problem. I imagined it would be as simple as ply:Team().tieroneunlocked = true but doesn’t ply:Team() only return an enumeration? I haven’t test this yet but I have the feeling it’ll just error. Can anybody shed some light?

You cant add a variable to a team, because ply:Team() just returns a number but you could have a global table like so
[lua]teamtable = {}
function SetTierOne(ply)
teamtable[ply:Team()].tieroneunlocked = true

Yeah, that’s what I ended up doing. Almost verbatim. I eventually ended up with unlocked[ply:Team()][category]=tier So shotguns tier 3 would be unlocked[ply:Team()][“shotguns”]=3

Teams ain’t some kinda entity or place to store stuff in. Store stuff using tables:
TeamTables = {}
function team.Store(team, ind, var)
TeamTables[team][ind] = var

function team.GetStore(team, ind)
return TeamTables[team][ind]
This could be properly made with metatables I think, but I cba that.

Attempt to index ? a nil value.

get out
It was a example :stuck_out_tongue:

local teaminfo = {}

__index = function(i,k) return teaminfo* and teaminfo*[k] end,
__newindex = function(i,k,v) teaminfo* = teaminfo* or {} teaminfo*[k] = v end