If you need, I have did long time ago this script which handles both regular HandleAdornment and RotateHandleAdornment.
local handle = script.Parent --HandleAdornment
local archandle = script.Parent.Parent.Rotate --RotateHandleAdornment
local Mode = "Move"
local ContextActionService = game:GetService("ContextActionService")
local Target = nil
local Player = game:GetService("Players").LocalPlayer
local mouse = Player:GetMouse()
--for rotation
local increment = 5
local lastCFrame = nil
--for moving/resizing
local oldDelta = 0
local snap = 0.25
local smallestSize = 0.25
local surfaceAxis = {
[Enum.NormalId.Top] = 'Y',
[Enum.NormalId.Bottom] = 'Y',
[Enum.NormalId.Front] = 'Z',
[Enum.NormalId.Back] = 'Z',
[Enum.NormalId.Left] = 'X',
[Enum.NormalId.Right] = 'X'
}
local function onSwitch1(actionName, userInputState, input)
if (userInputState == Enum.UserInputState.Begin) then
if Mode == "Move" then
Mode = "Resize"
handle.Style = "Resize"
handle.Color3 = Color3.fromRGB(255, 0, 255)
elseif Mode == "Resize" then
Mode = "Rotate"
archandle.Adornee = handle.Adornee
handle.Adornee = nil
elseif Mode == "Rotate" then
Mode = "Move"
handle.Adornee = archandle.Adornee
archandle.Adornee = nil
handle.Style = "Movement"
handle.Color3 = Color3.fromRGB(255, 255, 0)
end
end
end
local function onSwitch2(actionName, userInputState, input)
if (userInputState == Enum.UserInputState.Begin) then
if Mode == "Move" then
Mode = "Rotate"
archandle.Adornee = handle.Adornee
handle.Adornee = nil
elseif Mode == "Resize" then
Mode = "Move"
handle.Style = "Movement"
handle.Color3 = Color3.fromRGB(255, 255, 0)
elseif Mode == "Rotate" then
Mode = "Resize"
handle.Adornee = archandle.Adornee
archandle.Adornee = nil
handle.Style = "Resize"
handle.Color3 = Color3.fromRGB(255, 0, 255)
end
end
end
handle.MouseDrag:Connect(function(face, distance)
local delta = distance - oldDelta
if math.abs(delta * 1.125) >= snap then
if Mode == "Move" then
delta = math.round(delta / snap) * snap
local direction = Vector3.fromNormalId(face)
local move = Vector3.new(direction.X, direction.Y, direction.Z)
local endPosition = handle.Adornee.Position + move * delta
handle.Adornee:PivotTo(handle.Adornee.CFrame * CFrame.new(direction * delta))
oldDelta = distance
elseif Mode == "Resize" then
delta = math.round(delta / snap) * snap
local direction = Vector3.fromNormalId(face)
local size = Vector3.new(math.abs(direction.X), math.abs(direction.Y), math.abs(direction.Z))
local endSize = handle.Adornee.Size + size * delta
if endSize[surfaceAxis[face]] >= smallestSize then
handle.Adornee.Size = endSize
handle.Adornee:PivotTo(handle.Adornee.CFrame * CFrame.new(direction / 2 * delta))
oldDelta = distance
end
end
end
end)
handle.MouseButton1Up:Connect(function()
oldDelta = 0
end)
function round(number)
return math.floor((number / increment) + 0.5) * increment
end
function AngleFromAxis(axis, r)
local relativeAngle = math.rad(round(math.deg(r)))
return axis == Enum.Axis.X and {relativeAngle, 0, 0}
or axis == Enum.Axis.Y and {0, relativeAngle, 0}
or axis == Enum.Axis.Z and {0, 0, relativeAngle}
end
archandle.MouseDrag:Connect(function(axis, relativeAngle, delta)
archandle.Adornee.CFrame = lastCFrame * CFrame.Angles(unpack(AngleFromAxis(axis, relativeAngle)))
end)
archandle.MouseButton1Down:Connect(function()
lastCFrame = archandle.Adornee.CFrame
end)
mouse.Button1Down:Connect(function()
if mouse.Target == Target or mouse.Target == nil then
Target = nil
handle.Adornee = nil
archandle.Adornee = nil
else
Target = mouse.Target
if Mode == "Move" or Mode == "Resize" then
handle.Adornee = Target
elseif Mode == "Rotate" then
archandle.Adornee = Target
end
end
end)
ContextActionService:BindAction("switch1", onSwitch1, false, Enum.KeyCode.Z)
ContextActionService:BindAction("switch2", onSwitch2, false, Enum.KeyCode.X)
(Note - it should be parented under HandleAdornment to show work in this example. You will need to rewrite it for your use-case)