I was wondering the same, after a little time i found this algorithm to make something into a grid:
local X = math.floor(Position.X/GridSize+0.5)*GridSize
local Y = math.floor(Position.Y/GridSize+0.5)*GridSize
local Z = math.floor(Position.Z/GridSize+0.5)*GridSize
Pos = Vector3.new(X,Y,Z)