So here is a script I sort of modified and I want to know how to make the bricks be placed on a 1 stud instead of using no grid. Below is the script.
tool = script.Parent function click(mouse) local part = Instance.new("Part") part.Position = mouse.hit.p part.Parent = game.Workspace part.Anchored = true end function selected(mouse) mouse.Button1Down:connect(function () click(mouse) end) end tool.Selected:connect(selected)
ill try to explain the best I can! Reply if you need me to clear something up.
So the basics behind what you want to do is simple! Lets say hypothetically that mouse.Hit.p == 0.1, 0.5, 0.9
Knowing that math.floor( NUMBER )
returns NUMBER rounded down, always down.
So if you took each offset value of mouse.Hit.p
and added 0.5 to it, then round it down. You would have the closest whole number.
Local Pos = Vector3.new( math.floor(mouse.Hit.p.X + 0.5),math.floor(mouse.Hit.p.Y + 0.5),math.floor(mouse.Hit.p.Z + 0.5)) -- as an example