TheProNoob2004

Draw Tool

Jun 22nd, 2016
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.60 KB | None | 0 0
  1. ------------------------------------------Change TheProNoob2004 with your username-------Thanks-----------------------------
  2. me = game.Players.TheProNoob2004
  3. char = me.Character
  4. hold = false
  5. thickness = 0.1
  6. maxt = 10
  7. bricks = {}
  8.  
  9. color = BrickColor.new("Black")
  10. colors = {}
  11. for i=0,63,1 do
  12. table.insert(colors, BrickColor.palette(i))
  13. end
  14.  
  15. function checkt()
  16. if thickness < 0.1 then
  17. thickness = 0.1
  18. end
  19. if thickness > maxt then
  20. thickness = maxt
  21. end
  22. end
  23.  
  24. function makegui()
  25. local maxx = 200
  26. local x = 0
  27. local y = 0
  28. local g = Instance.new("ScreenGui")
  29. g.Name = "Colors"
  30. local fr = Instance.new("Frame",g)
  31. fr.Position = UDim2.new(0, 10, 0.3, 0)
  32. fr.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
  33. fr.BorderColor3 = Color3.new(0,0,0)
  34. local txt = nil
  35. local txt2 = nil
  36. local txt3 = nil
  37. for i,v in pairs(colors) do
  38. local gah = Instance.new("TextButton",fr)
  39. gah.Position = UDim2.new(0, x + 3, 0, y + 3)
  40. gah.Size = UDim2.new(0, 25, 0, 25)
  41. gah.BackgroundColor = v
  42. gah.BorderColor3 = Color3.new(0,0,0)
  43. gah.Text = ""
  44. gah.MouseButton1Down:connect(function()
  45. color = v
  46. txt.Text = v.Name
  47. end)
  48. gah.MouseEnter:connect(function()
  49. txt2.Text = v.Name
  50. end)
  51. gah.MouseLeave:connect(function() txt2.Text = ""
  52. end)
  53. x = x + 28
  54. if x >= maxx then
  55. x = 0
  56. y = y + 28
  57. end
  58. end
  59. fr.Size = UDim2.new(0, maxx + 27, 0, y + 40)
  60. txt = Instance.new("TextLabel",fr)
  61. txt.Size = UDim2.new(0.95, 0, 0, 35)
  62. txt.Position = UDim2.new(0.025, 0, 0, y + 3)
  63. txt.Text = color.Name
  64. txt.BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)
  65. txt.BorderColor3 = Color3.new(0, 0, 0)
  66. txt.TextColor3 = Color3.new(1, 1, 1)
  67. txt.FontSize = "Size24"
  68. txt.Font = "ArialBold"
  69. txt.TextYAlignment = "Bottom"
  70. txt.TextXAlignment = "Left"
  71. txt2 = Instance.new("TextLabel",txt)
  72. txt2.Size = UDim2.new(1, 0, 0, 0)
  73. txt2.Text = color.Name
  74. txt2.BackgroundTransparency = 1
  75. txt2.TextColor3 = Color3.new(1, 1, 1)
  76. txt2.FontSize = "Size12"
  77. txt2.TextYAlignment = "Top"
  78. txt2.TextXAlignment = "Right"
  79. txt3 = Instance.new("TextLabel",fr)
  80. txt3.Size = UDim2.new(0.5, 0, 0, 25)
  81. txt3.Position = UDim2.new(0.25, 0, 1, 0)
  82. txt3.BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)
  83. txt3.BorderColor3 = Color3.new(0,0,0)
  84. txt3.TextColor3 = Color3.new(1,1,1)
  85. txt3.FontSize = "Size12"
  86. txt3.Text = thickness
  87. g.Parent = me.PlayerGui
  88. coroutine.resume(coroutine.create(function()
  89. while g.Parent ~= nil do
  90. txt3.Text = thickness
  91. wait()
  92. end
  93. end))
  94. end
  95.  
  96. function remgui()
  97. for i,v in pairs(me.PlayerGui:children()) do
  98. if v.Name == "Colors" then v:remove() end
  99. end
  100. end
  101.  
  102. if script.Parent.className ~= "HopperBin" then
  103. h = Instance.new("HopperBin",me.Backpack)
  104. h.Name = "Draw"
  105. script.Parent = h
  106. end
  107.  
  108. bin = script.Parent
  109.  
  110. function weld(p1, p2)
  111. local w = Instance.new("Weld")
  112. w.Part0 = p2
  113. w.Part1 = p1
  114. w.C0 = p2.CFrame:toObjectSpace(p1.CFrame)
  115. w.Parent = p2
  116. end
  117.  
  118. function B1D(mouse)
  119. hold = true
  120. coroutine.resume(coroutine.create(function()
  121. mouse.Button1Up:wait()
  122. hold = false
  123. end))
  124. local p = Instance.new("Part",char)
  125. p.formFactor = "Custom"
  126. p.Size = Vector3.new(1,0.5,0.5)
  127. p.Anchored = true
  128. p.TopSurface = 0
  129. p.BottomSurface = 0
  130. p.CanCollide = false
  131. p.BrickColor = color
  132. p.Locked = true
  133. local m = Instance.new("BlockMesh",p)
  134. local targ = mouse.Target
  135. table.insert(bricks, p)
  136. local pos = mouse.Hit.p
  137. while hold do
  138. local mag = (pos - mouse.Hit.p).magnitude
  139. m.Scale = Vector3.new(thickness, 0.4, (mag+(thickness/3))*2)
  140. p.CFrame = CFrame.new(pos, mouse.Hit.p) * CFrame.new(0, 0, -mag/2 - thickness/5)
  141. if mag > thickness/2+0.1 then
  142. B1D(mouse)
  143. if targ ~= nil then
  144. if targ.Anchored == false then
  145. p.Anchored = false
  146. weld(p, targ)
  147. end
  148. end
  149. break
  150. end
  151. wait()
  152. end
  153. end
  154.  
  155. bin.Selected:connect(function(mouse)
  156. makegui()
  157. mouse.KeyDown:connect(function(key)
  158. key = key:lower()
  159. local kh = true
  160. coroutine.resume(coroutine.create(function()
  161. mouse.KeyUp:wait()
  162. kh = false
  163. end))
  164. if key == "q" then
  165. while kh do
  166. thickness = thickness - 0.1
  167. checkt()
  168. wait()
  169. end
  170. elseif key == "e" then
  171. while kh do
  172. thickness = thickness + 0.1
  173. checkt()
  174. wait()
  175. end
  176. elseif key == "z" then
  177. while kh do
  178. if #bricks > 0 then
  179. bricks[#bricks]:remove()
  180. table.remove(bricks, #bricks)
  181. end
  182. wait()
  183. end
  184. elseif key == "f" then
  185. for i = #bricks, 1, -1 do
  186. bricks[i]:remove()
  187. table.remove(bricks, i)
  188. end
  189. end
  190. end)
  191. mouse.Button1Down:connect(function()
  192. B1D(mouse)
  193. end)
  194. end)
  195.  
  196. bin.Deselected:connect(function()
  197. remgui()
  198. end)
Add Comment
Please, Sign In to add comment