Plugin - Part movement?

I’m working on a Plugin at the moment and I’m looking for a way to drag a part along a specific axis with increments involved.

Basically, I’m trying to recreate the ROBLOX Studio drag.
This is currently where I’m at - But I have ran into issues:

Plugin.Heartbeat = function()
	if _Global["Setting"] == script.Name then
		
		if Axis.X then
			if (_Global["Mouse"].Hit.p - Target.CFrame.p).Magnitude > 1 then
				Target.CFrame = Target.CFrame + Vector3.new(1, 0, 0)
			elseif (_Global["Mouse"].Hit.p - Target.CFrame.p).Magnitude < 1 then
				Target.CFrame = Target.CFrame - Vector3.new(1, 0, 0)
			end
		end
		
	end
end

Does anyone have any suggestions?