local playerCaptureTable = {}
local blueRoster = serverStorage.GameValues.BlueTeamRoster:GetChildren()
local redRoster = serverStorage.GameValues.RedTeamRoster:GetChildren()
print ("blueRoster : ")
print (blueRoster) --shows it has items
print ("redRoster : ")
print (redRoster)--shows it has items too
if blueRoster and #blueRoster >= 1 and redRoster and #redRoster >= 1 then --has no problem passing this test
local combinedRostersTable = module.CombineTables(blueRoster, redRoster)--this comes up "attempt to all nil value"
the above code is in a module on the Server:
there are stringvals in a folder in server storage. it grabs all those and makes an indexed array of them (blueRoster)
2)it does the same thing with a second folder, and makes a second array. (redRoster)
it WOULD call a function within the same module to combine them - but never calls the function (print statements show it isn’t called) and that line gives us a “attempt to call nil value” error…
there are definitely occupants in both rosterfolders (checked it)
AND print statements also show my tables are occupied (not nil)
Also, all my StringVals are pre initialized (not nil)
Any idea what is happening? I’ve been troubleshooting this like mad
Thx!
Are you sure it’s the correct module? Or that the module actually returns a table with that method? Or that the function is not spelled differently (caps)? If that’s the erroring line then CombineTables is nil.
here is the CombineTables function - is there some reason it is returning nil that I don’t see?:
function CombineTables(table1, table2)
local FinalTable = {}
print("inside combine tables 214")
if table1 and #table1 >= 2 then
for i,v in pairs(table1) do
table.insert(FinalTable,v)
end
elseif table1 and #table1 == 1 then
print(" elseif table1 and #table1 == 1 then")
table.insert(FinalTable,table1[1])
end
if table2 and #table2 >= 2 then
for i,v in pairs(table2) do
table.insert(FinalTable,v)
end
elseif table2 and #table2 == 1 then
table.insert(FinalTable,table2[1])
print(" elseif table2 and #table2 == 1 then")
end
print("FinalTable")
print(FinalTable)
return FinalTable
end
incidentally, none of these print statements fire, because it never calls the function?