ryanswagg20

Draw

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