Advertisement
recalculated

Draw Tool

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