so im trying to make a food system. people grab food and get it in their inventory this is a little bit of my code:
local itemName = item.Name local itemStat = objectStats[itemName] -- error is here local tangible = ss.Items:FindFirstChild(itemName)
in the module script:
local module = { ["Pumpkin"] = { ["image"] = 453112717, ["edible"] = true, ["hunger"] = 12, ["thirst"] = 5, ["heal"] = 3, ["bundleSize"] = 1, }, } return module
Obviously objectStats
doesn't exist. Odds are you made a typo.
Please check your variable names next time you write code so you don't make the same mistake and come begging for us to fix your code. It's unreal and downright unnecessary.
Did you possibly forget to define objectStats
, or did you just define it as local inside of a higher scope where the script can't read it?
Or did you forget to assign the variable to the required module?
local objectStats = require(script.Module) -- The module location inside of require()
Sometimes you slip up. Sometimes you make mistakes that need to be corrected. Try correcting them before coming to us.