-
I am trying to make a levelling system based on tables, and trying to get a level value from a defined table in a different modular script, basically storing the requiredEXP to level up in a table.
-
when I get the level, lets say 1 for example, using table.find or iterating the table with for i,v in pairs, it returns nil.
-
I have tried using some other solutions such as for i = 1, #requiredEXP (table) but it comes out as the same result. Most of the posts are on alphabetical variables in the table, not numerical.
local RequiredEXP = {
["1"] = 30,
["2"] = 55,
["3"] = 83,
["4"] = 108,
["5"] = 144,
["6"] = 183,
["7"] = 233,
}
for i,v in pairs(RequiredEXP) do
local item = RequiredEXP[i]
if item == LevelData then
print(item)
else
print(item)
end
end
--// or
local LevelData = PlayerDataHandler:Get(plr, "Level")
print(table.find(RequiredEXP, LevelData)
--// or
local REQ = RequiredEXP[LevelData]
print(REQ)