Advertisement
Fatblabs

Click Drag In roblox

Apr 1st, 2020
1,207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local mouse = player:GetMouse()
  3. local down
  4. local mtarget
  5.  
  6. clickmoveon = true
  7.  
  8. function clickObj()
  9. if mouse.Target ~= nil then
  10. mtarget = mouse.Target
  11. down = true
  12. mouse.TargetFilter = mtarget
  13. end
  14. end
  15. mouse.Button1Down:connect(clickObj)
  16.  
  17. function mouseMove()
  18. if down and mtarget then
  19. local posX,posY,posZ = mouse.hit.X, mouse.hit.Y, mouse.hit.Z
  20. if clickmoveon then
  21. mtarget.Position = Vector3.new(posX,posY,posZ)
  22. end
  23. end
  24. end
  25.  
  26. mouse.Move:connect(mouseMove)
  27.  
  28. function mouseDown()
  29. down = false
  30. mouse.TargetFilter = nil
  31. end
  32.  
  33. mouse.Button1Up:connect(mouseDown)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement