Guess I found out a way. Sorry for the post.
You can use UserInputService.InputBegan and InputEnded to check if the player is holding the mousebutton2 (right one):
local UIS = game:GetService("UserInputService")
local rightclick = false
UIS.InputBegan:connect(function(input,process)
if not process and input.UserInputType == Enum.UserInputType.MouseButton2 then
rightclick = true
end
end)
UIS.InputEnded:connect(function(input,process)
if input.UserInputType == Enum.UserInputType.MouseButton2 then
rightclick = false
end
end)
After this you use UserInputService.InputChanged to check if the player moved the mouse and then, if he is holding the mousebutton2, do the code:
UIS.InputChanged:Connect(function(input,process)
if rightclick == true and input.UserInputType == Enum.UserInputType.MouseMovement then
end
end)