Table returns 0 children instead of the number of children

I want to index points by value and when i try to call the number of children with hashtag it returns 0

I want to be able to get the number of children.

local points = {}
function getPoints()
	for x = - 50, 50,5 do
		for y = -50,50,5 do
			for z = -50, 50,5 do
				if math.abs(x) > 6 and math.abs(z) > 6 then
					points[Vector3.new(x,y,z)] = Vector3.new(x,y,z)

				end
			end
		end
	end
	
end

wait(1)
print(#points)
getPoints()
wait(1)
print(#points) --returns 0 for some reason

this most likely means the table has no children

it has children with points[Vector3.new(x,y,z)] = Vector3.new(x,y,z)

This is because the # operator only works on numerically indexed tables. to get the result you’re looking for, replace

points[Vector3.new(x,y,z)] = Vector3.new(x,y,z)

with

table.insert(points, Vector3.new(x,y,z))