Trouble Figuring out Method of Node Snapping

Hello, I have been stuck looking at this for a while thinking of various solutions as to fix this; currently, I have it so it doesn’t have different node snapping and it only rotates around on axis. I want to be able to fix this so I am able to make all kinds of shapes but I just need someone to guide me in the right direction. I’ve read various posts that could possibly solve this but I am unable to figure this out. Any help is appreciated, thanks :slight_smile:


local function MovePipe()
	local HitCF, HitNormal, HitInstance = Raycast()
	if not HitCF then return end
	
	local MoveCF = (HitInstance.Name == "Node" and HitInstance.CFrame * CFrame.new(0,0,-Offset)) or HitCF
	
	CurrentModel:PivotTo(MoveCF * CFrame.Angles(0, 0, ModelRotation))
end

image
(More transparent square is where the other square is supposed to snap to

)