local XIncrement, XLength = 21, 21 * 5
local ZIncrement, ZLength = 21, 21 * 5
local MapValues = {}
local Map = {}
-- making the table
for X = 0, XLength, XIncrement do
for Z = 0, ZLength, ZIncrement do
table.insert(Map, Vector2.new(X, Z))
MapValues[Vector2.new(X, Z)] = {
1 -- this is the value of the gridpoint
}
end
end
--assigning random traps
local RandomCoordinate = MapValues[Map[math.random(#Map)]]
for randospot = 0, 5, 1 do
RandomCoordinate = MapValues[Map[math.random(#Map)]]
print(RandomCoordinate)
end
So I am basically trying to make a grid (players canβt interact with the grid). I made a 6x6 grid starting from the origin and each grid being 21 studs long (square). I want to choose random grid spots and read their value, which should of been set to β1β. This only prints nil (x6).