Hello there!
There are plenty of free-modeled rotate tools you can take a look at and see how you can implement one of these systems.
The first parameter of the MouseDrag event is the axis
that the player dragged their mouse on. The second one is just the RelativeAngle (which has no wiki documentation so I don’t know what it is) so you can just use if statements and detect which axis they dragged on and then you can perform CFrame operations on them using basic math.
I created a quick prototype in studio to test this system out and it works pretty neat. (It’s in a local script in StarterGui, this is just a demonstration, it won’t work in FilteringEnabled)
https://gyazo.com/c2bfd86cb6f00bf4c12fc40458b8b169
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local increment = 5
local lastCFrame = nil
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
script.Parent.ArcHandles.MouseDrag:Connect(function(axis, relativeAngle, delta)
workspace.Part.CFrame = lastCFrame * CFrame.Angles(unpack(AngleFromAxis(axis, relativeAngle)))
end)
script.Parent.ArcHandles.MouseButton1Down:Connect(function()
lastCFrame = workspace.Part.CFrame
end)
Feel free to ask any questions you may have!