Advertisement
KeroroGunso0

draw tool

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