✓ Accepted answer
So from i see from your code you are trying to check if that spot is not taken yet, there are multiple ways of doing it based off the situation.
You can add the vector value into table and then check if the value is in the table (This is what you were trying to do if i'm right)
Here is example of it:
local takenVectors = {
Vector3.new(0, 2, 0),
Vector3.new(0, 0, 4),
}
local newVector = Vector3.new(0, 2, 0)
for index, takenVector in pairs(takenVectors) do
if takenVector == newVector then
print("Spot is taken!")
break
end
end
If you would like to change specific vector in the table (Like you said something (also i mean ["a"] = "a" types)) you can try this method:
local takenVectors = {}
local newVector = Vector3.new(0, 0, 0)
takenVectors[tostring(newVector)] = newVector
for index, vector in pairs(takenVectors) do
print(index, vector)
end
I don't know if this is what you need and i don't know if this is efficient method of indexing but it works atleast and you can access the vector from the table by doing print(takenVectors["0, 0, 0"]).