Advertisement
Idirina

Draw Script

Jan 21st, 2018
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 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. local size = 0.5
  14.  
  15. userinputservice = game:GetService("UserInputService")
  16.  
  17. userinputservice.InputBegan:connect(function(input, gpe)
  18. if not gpe then
  19. if input.UserInputType == Enum.UserInputType.Keyboard then
  20. local key = input.KeyCode
  21. if key == Enum.KeyCode.Z then
  22. size = size - 0.5
  23. end
  24. if key == Enum.KeyCode.X then
  25. size = size + 0.5
  26. end
  27. if key == Enum.KeyCode.C then
  28. print(size)
  29. end
  30. end
  31. end
  32. end)
  33.  
  34. mouse = plyr:GetMouse()
  35.  
  36.  
  37. function draw(obj) --
  38. local lastPos = obj.CFrame.p
  39. coroutine.wrap(function()
  40. while wait() do
  41. if draw2 then
  42. while draw2 do
  43. RunService.Stepped:wait()
  44. objC = obj:Clone()
  45. objC.Parent = c
  46. objC.Anchored = true
  47. local distance = (lastPos- obj.CFrame.p).magnitude
  48. objC.Size = Vector3.new(size,0.5,distance + size)
  49. objC.CFrame = CFrame.new(lastPos,obj.Position)*CFrame.new(0,0,-distance/2)
  50. lastPos = obj.CFrame.p
  51. end
  52. else
  53. break
  54. end
  55. end
  56. end)()
  57. end
  58.  
  59. tool.Selected:connect(function(mouse)
  60.  
  61. mouse.Button1Down:connect(function(mouse)
  62. part = Instance.new("Part", c)
  63. part.Name = "location"
  64. part.BottomSurface = 0
  65. part.TopSurface = 0
  66. part.BrickColor = BrickColor.new("Institutional white")
  67. part.FormFactor = "Custom"
  68. part.Size = Vector3.new(1, 0.2, 1)
  69. part.Anchored = true
  70. part.Locked = true
  71. coroutine.wrap(function()
  72. while part ~= nil do
  73. part.CFrame = CFrame.new(plyr:GetMouse().Hit.p.x,plyr:GetMouse().Hit.p.y,plyr:GetMouse().Hit.p.z)
  74. RunService.Stepped:wait()
  75. end
  76. end)()
  77. draw(part)
  78. draw2 = true
  79. end)
  80. mouse.Button1Up:connect(function(mouse)
  81. game:service'Debris':AddItem(part, 0)
  82. draw2 = false
  83. pcall(function()
  84. lastPos = nil
  85. end)
  86.  
  87. end)
  88.  
  89. end)
  90.  
  91.  
  92. print([["Z to decrease size by 0.5
  93. X to increase size by 0.5
  94. C to show size"]])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement