"_ isn't a valid member of table" when it is

What do you want to achieve?
I want to get a value from a dictionary.
What is the issue?
The game tells me something isn’t a valid member of a dictionary when it is.
What solutions have you tried so far?
Tried changing name of the variable in case it confuses it with another variable.

	for _, boss in pairs(bosses:GetChildren()) do
		local range = boss.range
		local magnitude = (range.Position - character.HumanoidRootPart.Position).magnitude
		local specificEnemyData = enemyData[boss.enemyId.Value]
		print(enemyData, specificEnemyData, boss.enemyId.Value) --Prints " { [1] =  ▶ {...} } nil 1"
		if magnitude <= specificEnemyData.attackRange then
			hitEvent:FireServer(boss)
		end
	end

Try doing

print(typeof(boss.enemyId.Value))

It’s the only reason I can think of.

Just realized I put a StringValue and not a NumberValue, thanks.

1 Like