Table error when insert values

When i trying to put value in
tableParam[playerName]["Bool"]
it printing
attempt to index nil with 'Bool'

Code that i tried:
table.insert(tableParam[playerName]["Bool"],value)
tableParam[playerName]["Bool"] = value

You have to insert a table into the playerName key, and then you can insert into that sub table.

Something like

local tableParam = {}

tableParam[playerName] = {}
tableParam[playerName]["Bool"] = value

Or insert the table and the value in one go:

tableParam[playerName] = {
  Bool = value
}
1 Like