Advertisement
dahpiglz

Drag

Oct 25th, 2017
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.15 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local mouse = player:GetMouse()
  3.  
  4. local targeting = 0
  5. local targetingpart = 0
  6. local targetingobject = nil
  7. local targetselection = nil
  8.  
  9. local beam = nil
  10.  
  11. mouse.Button1Down:connect(function()
  12. local target = mouse.Target
  13. if mouse.Target ~= nil then
  14. if mouse.Target.ClassName == ("Part") then
  15. if target.Parent:FindFirstChild("Humanoid") ~= nil then
  16. targeting = 1
  17. targetingobject = target
  18. for i,v in pairs(targetingobject.Parent:GetChildren()) do
  19. if v.ClassName == ("Part") then
  20. v.Anchored = false
  21. v.CanCollide = false
  22. end
  23. end
  24. t = Instance.new("Part")
  25. t.Anchored = true
  26. t.BrickColor = BrickColor.new("Electric blue")
  27. t.CanCollide = false
  28. t.Parent = game.Workspace
  29. t.Shape = ("Ball")
  30. t.Transparency = 0.5
  31. t.Reflectance = 0.5
  32. t.Size = Vector3.new(3,3,3)
  33. t.TopSurface = ("Smooth")
  34. t.BottomSurface = ("Smooth")
  35. t.Material = ("Neon")
  36. targetselection = t
  37. local a1 = Instance.new("Attachment")
  38. a1.Parent = player.Character["Right Arm"]
  39. local a2 = Instance.new("Attachment")
  40. a2.Parent = t
  41.  
  42. local b = Instance.new("Beam")
  43. beam = b
  44. beam.Color = Color3.fromRGB(0, 166, 255)
  45. beam.Attachment0 = a1
  46. beam.Attachment1 = a2
  47. beam.Texture = ("rbxassetid://1196410051")
  48. beam.FaceCamera = true
  49. beam.CurveSize1 = 5
  50. beam.Segments = 100
  51. beam.Parent = player.Character
  52. end
  53. else
  54. if target.Name ~= ("Base") then
  55. targetingpart = 1
  56. t = Instance.new("Part")
  57. t.Anchored = true
  58. t.BrickColor = BrickColor.new("Electric blue")
  59. t.CanCollide = false
  60. t.Parent = game.Workspace
  61. t.Shape = ("Ball")
  62. t.Transparency = 0.5
  63. t.Reflectance = 0.5
  64. t.Size = Vector3.new(3,3,3)
  65. t.TopSurface = ("Smooth")
  66. t.BottomSurface = ("Smooth")
  67. t.Material = ("Neon")
  68. targetselection = t
  69. targetingobject = target
  70. end
  71. end
  72. end
  73. end)
  74.  
  75. mouse.Button1Up:connect(function()
  76. if targeting == 1 then
  77. targeting = 0
  78. for i,v in pairs(targetingobject.Parent:GetChildren()) do
  79. if v.ClassName == ("Part") then
  80. v.Anchored = false
  81. v.CanCollide = true
  82. end
  83. end
  84. if beam ~= nil then
  85. beam:Destroy()
  86. beam = nil
  87. end
  88. if targetselection ~= nil then
  89. targetselection:Destroy()
  90. targetselection = nil
  91. end
  92. end
  93. if targetingpart == 1 then
  94. targetingpart = 0
  95. if targetselection ~= nil then
  96. targetselection:Destroy()
  97. targetselection = nil
  98. end
  99. end
  100. end)
  101.  
  102. while true do
  103. if targeting == 1 then
  104. if targetingobject ~= nil then
  105. if targetingobject.Parent:FindFirstChild("HumanoidRootPart") ~= nil then
  106. targetingobject.Parent.HumanoidRootPart.CFrame = mouse.Hit
  107.  
  108. if targetselection ~= nil then
  109. targetselection.CFrame = targetingobject.Parent.HumanoidRootPart.CFrame
  110. end
  111.  
  112. end
  113. end
  114. end
  115. if targetingpart == 1 then
  116. if targetingobject ~= nil then
  117. if targetingobject.ClassName == ("Part") then
  118. targetingobject.CFrame = mouse.Hit
  119. if targetselection ~= nil then
  120. targetselection.CFrame = targetingobject.CFrame
  121. end
  122. end
  123. end
  124. end
  125. wait(0.01)
  126. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement