Make parts snap to grid on non-aligned surfaces

I’m planning on making something of a free-form building game where the player creates objects by welding and manipulating individual components. I’ve done most of the work of creating the components, and I can assemble them in-Studio using the built-in tools, but I struggle to find or create a system that lets the player do something similar.

The main challenge I find is making the parts align with one another. I understand how to attach parts, and to make things move with the mouse, but I need these things to align on a 1x1 grid on the surface of the part itself.

Classic build tools already do this using the Dragger instance to my knowledge, but this won’t suit my purpose. Any advice?


Search up top for posts with the phrase ‘grid building system’.
You can make a 1x1x1 grid build setup with the answers on those posts, or try slightly different searches like ‘in game building tool’ etc.

Basically you take the size of the item you are building with and align its center on your grid, where the edges of the item you are adding are calculated by using half the item’s x, y or z dimensions from center.


This would appear to be the sort of solution I’m looking for. Thinking through it, this would work. I’ll give some updates on what I’m doing with this as time goes on.

Good day and happy* coding!


You could fire 3 raycasts towards the mouse to get the plane of the grid that your part will snap to, and use the CFrame/Size of the target part to snap it to a 1 stud grid.

It could get tricky on wedges and parts which have a size of 1.5 by 1.2 by 2.6 for example. I would just set the grid’s anchor point to the corner closest to the mouse for parts like that, but that could result in placing parts inside of each other.

Grid building systems are definitely one of the most complicated things in Roblox programming in my opinion, so good luck, I hope this post helps :slight_smile:

1 Like