I have searched youtube but i really haven't found a good example/ explanation. I have it so you can click and move and when you release stop moving it. Trying to add q to rotate it clockwise but i don't know how. Script:
--// Variables\\--
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local mtarget
local down
--// Functions \\--
function ObjClick()
if mouse.Target ~= nil then
mtarget = mouse.Target
mouse.TargetFilter = mtarget
down = true
end
end
mouse.Button1Down:Connect(ObjClick) --clicking triggers this
function mouseMove()
if mouse and mtarget then
local posX,posY,posZ = mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z -- moving obj
mtarget.Position = Vector3.new(posX,posY,posZ)
end
end
mouse.Move:Connect(mouseMove)
function mouseDown() --releasing triggers this
down = false
mouse.Target = nil
mouse.TargetFilter = nil
end
mouse.Button1Up:Connect(mouseDown)
--// Rotation of obj \\--
game:GetService("UserInputService").InputBegan:Connect(function(input,gameprocessed)
if input.KeyCode == Enum.KeyCode.Q then
--dont know how to rotate the object :/
end
end)
game:GetService("UserInputService").InputBegan:Connect(function(input,gameprocessed)
if input.KeyCode == Enum.KeyCode.E then
--dont know how to rotate the object Clock wise :/
end
end)

3 comments
mtarget is the object clicked
You can use CFrames
i dont know how if you could answer me and explain how i would use it in the situation that would really help. :D