I need help redesigning a move tool

I have put together a move tool:

local eventdebounce = false



--main code for dragging
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local down
local mtarget

function clickObj()
if mouse.Target ~= nil then
mtarget = mouse.Target
print(mtarget)
down = true
mouse.TargetFilter = mtarget
print(mouse.TargetFilter)
end
end
mouse.Button1Down:connect(clickObj)

function mouseMove()
if down and mtarget then

--conditions that need to be met before dragging
local core = mtarget:FindFirstChild("Core")
	if core then
	if core.Owner.Value == "none" then

	
--
 
	
local posX,posY,posZ = mouse.hit.X, mouse.hit.Y, mouse.hit.Z
mtarget.Parent:SetPrimaryPartCFrame(CFrame.new(Vector3.new(posX,posY,posZ)))

eventdebounce = true--enable remote event communication
end
end
end
end
mouse.Move:connect(mouseMove)

function mouseDown()
down = false
mouse.TargetFilter = nil

end
mouse.Button1Up:connect(mouseDown)
--







--relay info to server--
	while true do
		wait(0.5)
		if eventdebounce == true then
			local posinfo = mtarget.Position
			script.Parent.RemoteEvent:FireServer(mtarget,posinfo)
	print("Sent data to server")
	wait(0.5)
	eventdebounce = false
		end
		
	end
------------------------

this moves models with certain conditions, and for the most part it does work, but moving models is very glitchy this way as it follows the mouse it starts to spasm out and by the time the models parts attach to a certain surface the moved model is angled incorrectly. so it seems I have to redesign it.

I wanted to take this part moving tool from the studio:
movetoolcapture
and put it in a tool, this way players can just move a model up,down, or side to side instead of dragging it around, but my problem is I dont know how to do something like this. I dont want this to look like a request post but any help would be greatly appreciated.