What do you mean by “it doesn’t snap onto the object”?
For models you will have to update the position of every part, relative to the part in the model you are dragging. That or if you have a PrimaryPart for the model then you can use the :SetPrimaryPartCFrame() method to move the whole model in one line.
For increments you will need to save the first position of the part before it gets moved, and convert the new position’s x and z components to be rounded to the nearest integer based on the object space of the part’s original position. This is a 1x1 stud movement grid. To make grids for more than 1 stud, simply round to the nearest multiple of the amount of studs you want it to move (e.g. 5 studs, round to nearest multiple of 5).
To rotate and tilt the part, you need to multiply the CFrame of the part by the amount/axis you want to rotate it by. E.g.
local rotatedCFrame = CFrame.new()*CFrame.Angles(0, math.rad(90), 0) -- turns it 90 degrees, note the CFrame.Angles uses radians, so you need to use math.rad to convert degrees to radians unless you prefer to use radians
For rotating/tilting a model, all of the parts need to be rotated relative to the part of the model you are rotating, its much easier with a PrimaryPart of the model, because you can just use the :SetPrimaryPartCFrame() again to rotate it using the above line of code I just showed.
Also, I wouldn’t suggesting using wait() in that loop. I would use;
game:GetService'RunService'.RenderStepped:Wait()
Edit; If you are having trouble understanding these concepts, you should research each individually. There are tons of resources on this subject and you should not be subjecting yourself to problems that you aren’t currently equipped to solve. You should try to dissect this problem one step at a time. Your request is currently too large for me to have the time to fully help you with. You need the part/model to rotate, tilt, be draggable (with option for grid), resize (with dragging method roblox uses), and you haven’t really even started these functions. I would personally suggest starting with smaller goals;
- Move a part using CFrames
- Rotate a part using CFrames
- Move/Rotate a part relative to another part using CFrames
- Move/Rotate a part relative to another part using CFrames and locked to an increment stud amount of movement
- Move a part by setting it the mouse position.
- etc
I don’t think there are many people willing to break down every single step required to complete all the code you are trying to develop. Also, as mentioned prior, there are already people who have done these same things and posted how, and/or posted the source script(s). If you can dissect their code for what you need, and look up things you don’t understand/experiment with it, then you can learn everything you need to know. Then, when you have more specific questions about smaller portions of the code, those of us on the Developer Forum will be more than willing to help you figure that out.
If you aren’t willing to do that then I think you should consider scoping down your goals here.