Lets use some simple math to make sure they're spread apart from each other.
Our grid is 100x100, so lets assume its in the centre of the map.
Our parts are 5x5 each.
100/5 is 20. That means we have 20 possible places for each axis.
The centre of a 5x5 part is 2.5 by 2.5, however the boundaries of the grid are 50,50,-50,-50.
This means that the position of the 5x5 part must begin at 47.5, and iterate by 5.
1 | local positionX = math.random( 20 ) |
2 | local positionY = math.random( 20 ) |
4 | positionX = (positionX- 10.5 )* 5 |
5 | positionY = (positionY- 10.5 )* 5 |
7 | positionVector = Vector 3. new(positionX, 0 ,positionY) |
Alternatively this code can be condensed into
1 | positionVector = Vector 3. new((math.random( 20 ) - 10.5 )* 5 , 0 ,(math.random( 20 ) - 10.5 )* 5 ) |
Hope this is what you were looking for, or at least can build off of what I taught you.