DanielTG

Untitled

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