As explained in the title I am working on a game that requires that kind of part rotation (click+drag to rotate) as a main mechanic. I don't require that the script be created, that is against the rules i believe, I just want to know where to start and where to look for more info.
OR!!!!
You can make the object's position/CFrame the mouse.Hit.p right?
Here's a quick example:
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local Object = --bla bla bla Mouse.Changed(function()) Object.Position = Mouse.hit.p end)
Haven't tested it out but I am pretty sure it might work.
You can also use UserInputService(UIS) for the rotation part.
another example:
local UIS = game:GetService("UserInputService") UIS.InputBegan:Connect(function(input)) if input.KeyCode == Enum.KeyCode.R then // You can change R to whatever you want Object.Orientation = Object.Orientation + Vector3.new(0,0,0)--Change the number to your amount! end end) UIS.InputEnded:Connec(function(input)) if input.KeyCode == Enum.KeyCode.R then return end end)
Try checking out this tutorial on YouTube. It should help you.
https://www.youtube.com/watch?v=NSvBg7IYe7g
You need to first figure out when the mouse button is held down and when it is released:
local down, mouse = 0, game.Players.LocalPlayer:GetMouse() mouse.Button1Down:Connect(function() down = true end) mouse.Button1Up:Connect(function() down = false end) while true do wait() if down then --Insert rest of code that captures position/direction of mouse and rotates the object accordingly. end end
Create the rest of the code in that if the mouse is moving to the left then the object rotates to the left. If the mouse moves up then the object rotates up. The same for moving to the right and moving down.