Trumpledore

FreshDraw

May 25th, 2016
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. plyr = game.Players.LocalPlayer
  2. c = plyr.Character
  3. RunService = game:service'RunService'
  4. mouse = game.Players.LocalPlayer:GetMouse()
  5. local draw2 = false
  6. local colorA = 1
  7. local lastPos
  8.  
  9. tool = Instance.new("HopperBin", plyr.Backpack)
  10. tool.Name = "Draw"
  11.  
  12.  
  13.  
  14. mouse = plyr:GetMouse()
  15.  
  16.  
  17. function draw(obj) --
  18. local lastPos = obj.CFrame.p
  19. coroutine.wrap(function()
  20. while wait() do
  21. if draw2 then
  22. while draw2 do
  23. RunService.Stepped:wait()
  24. objC = obj:Clone()
  25. objC.Parent = c
  26. objC.Anchored = true
  27. local distance = (lastPos- obj.CFrame.p).magnitude
  28. objC.Size = Vector3.new(.2,.2,distance)
  29. objC.CFrame = CFrame.new(lastPos,obj.Position)*CFrame.new(0,0,-distance/2)
  30. lastPos = obj.CFrame.p
  31. end
  32. else
  33. break
  34. end
  35. end
  36. end)()
  37. end
  38.  
  39. tool.Selected:connect(function(mouse)
  40.  
  41. mouse.Button1Down:connect(function(mouse)
  42. part = Instance.new("Part", c)
  43. part.Name = "location"
  44. part.BottomSurface = 0
  45. part.TopSurface = 0
  46. part.BrickColor = BrickColor.Black()
  47. part.FormFactor = "Custom"
  48. part.Size = Vector3.new(0.2, 0.2, 0.2)
  49. part.Anchored = true
  50. part.Locked = true
  51. coroutine.wrap(function()
  52. while part ~= nil do
  53. part.CFrame = CFrame.new(plyr:GetMouse().Hit.p.x,plyr:GetMouse().Hit.p.y,plyr:GetMouse().Hit.p.z)
  54. RunService.Stepped:wait()
  55. end
  56. end)()
  57. draw(part)
  58. draw2 = true
  59. end)
  60. mouse.Button1Up:connect(function(mouse)
  61. game:service'Debris':AddItem(part, 0)
  62. draw2 = false
  63. pcall(function()
  64. lastPos = nil
  65. end)
  66.  
  67. end)
  68.  
  69. end)
Add Comment
Please, Sign In to add comment