# Need help with using handles on a model

I have no idea how Handles work for moving objects. I used some code I found in a couple of other places on the devforum, but it looks like information relating to how to use Handles is very limited.

This is what ends up happening: 2023-09-19 21-29-58 (the orientation issue I know how to solve - just trying to figure out how to make it move properly)

Basically, it just seems to exponentially calculate the distance at which the object is supposed to move.

Here’s my modified version of the code I’ve found on the devforum before:

``````script.Parent.MouseDrag:Connect(function(face, distance)

local newPos

print(face)

if face == Enum.NormalId.Back then
newPos = Object.PrimaryPart.Position + Vector3.new(0,0,distance)
Object:PivotTo(CFrame.new(newPos))
elseif face == Enum.NormalId.Bottom then
newPos = Object.PrimaryPart.Position + Vector3.new(0,-distance,0)
Object:PivotTo(CFrame.new(newPos))
elseif face == Enum.NormalId.Front then
newPos = Object.PrimaryPart.Position + Vector3.new(0,0,-distance)
Object:PivotTo(CFrame.new(newPos))
elseif face == Enum.NormalId.Left then
newPos = Object.PrimaryPart.Position + Vector3.new(-distance,0,0)
Object:PivotTo(CFrame.new(newPos))
elseif face == Enum.NormalId.Right then
newPos = Object.PrimaryPart.Position + Vector3.new(distance,0,0)
Object:PivotTo(CFrame.new(newPos))
end

end)
``````

Any help would be appreciated! Thanks in advance, folks.

It isn’t moving exponentially - what’s happening is that you appear to be moving the object based upon the movement of the mouse on screen. However, due to the distance, a movement on your screen will not be the same as a movement in the world with the dragger.

I don’t actually have a perfect solution, but this is a start for what appears to be a more mathy solution. A hack solution would be to use Mouse.Hit to determine where the mouse is targeting, and calculate the change in position based off of that, but that sounds fairly jank. Maybe take a look at the dragging handles in F3X, or some other piece of code. It is all up to you.