Snap part to grid?

image
This is my current code.
I would like to know how i could make newPart snap to a 3 by 3 grid

Hey!

I have some rough experience with this from a game I made last year. Here is a sample which should work…

	local newPart = Instance.new("Part")
	newPart.Size = Vector3.new(3, 3, 3)
	newPart.Position = Vector3.new(math.floor(mouse.Hit.p.x / 3 + 0.5) * 3, math.floor(mouse.Hit.p.y / 3 + 0.5) * 3, math.floor(mouse.Hit.p.z / 3 + 0.5) * 3)
	newPart.Anchored = true
	newPart.Parent = game.Workspace
end)

--Hope this helps :)
4 Likes