Advertisement
iiHackerii

Untitled

Sep 7th, 2016
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.30 KB | None | 0 0
  1. Size = 300
  2. Dots = {}
  3. Lines = {}
  4.  
  5. Primary = Color3.new()
  6. Secondary = Color3.new(1, 1, 1)
  7.  
  8. Palette = {}
  9. for i=0,63,1 do
  10. table.insert(Palette, BrickColor.palette(i))
  11. end
  12.  
  13. Me = game.Players.LocalPlayer
  14.  
  15. pcall(function() Me:findFirstChild("PlayerGui")["2D"]:remove() end)
  16.  
  17. ScreenGui = Instance.new("ScreenGui")
  18. ScreenGui.Name = "2D"
  19. ScreenGui.Parent = Me:findFirstChild("PlayerGui")
  20.  
  21. function GetResolution()
  22. local res = Vector2.new(ScreenGui.AbsoluteSize.x, ScreenGui.AbsoluteSize.y)
  23. if res.x < 1 then repeat wait() res = Vector2.new(ScreenGui.AbsoluteSize.x, ScreenGui.AbsoluteSize.y) until res.x > 0 end
  24. return res
  25. end
  26.  
  27. Screen = Instance.new("ImageButton",ScreenGui)
  28. Screen.BackgroundColor3 = Color3.new(0.45, 0.45, 0.45)
  29. Screen.BackgroundTransparency = 0.75
  30. Screen.Size = UDim2.new(0, Size, 0, Size)
  31. Screen.Position = UDim2.new(0.5, -Size/2, 0.5, -Size/2)
  32. Screen.AutoButtonColor = false
  33.  
  34. Color = Instance.new("ImageButton",Screen)
  35. Color.BackgroundColor3 = Color3.new(0.35, 0.35, 0.35)
  36. Color.BackgroundTransparency = 0.6
  37. Color.Size = UDim2.new(0, 200, 1, 0)
  38. Color.Position = UDim2.new(0, -205, 0, 0)
  39. Color.AutoButtonColor = false
  40. Color.Active = true
  41. Color.Draggable = true
  42.  
  43. ColorPrimary = Instance.new("ImageButton",Color)
  44. ColorPrimary.BackgroundColor3 = Primary
  45. ColorPrimary.Size = UDim2.new(0, 30, 0, 30)
  46. ColorPrimary.Position = UDim2.new(0, 20, 0, 20)
  47. ColorPrimary.BorderColor3 = Color3.new(1, 1, 1)
  48. ColorPrimary.ZIndex = 10
  49. ColorPrimary.AutoButtonColor = false
  50.  
  51. ColorSecondary = Instance.new("ImageButton",Color)
  52. ColorSecondary.BackgroundColor3 = Secondary
  53. ColorSecondary.Size = UDim2.new(0, 30, 0, 30)
  54. ColorSecondary.Position = UDim2.new(0, 30, 0, 30)
  55. ColorSecondary.BorderColor3 = Color3.new(1, 1, 1)
  56. ColorSecondary.ZIndex = 9
  57. ColorSecondary.AutoButtonColor = false
  58.  
  59. function Opposite()
  60. local pri = Primary
  61. local sec = Secondary
  62. Secondary = pri
  63. Primary = sec
  64. ColorPrimary.BackgroundColor3 = sec
  65. ColorSecondary.BackgroundColor3 = pri
  66. end
  67.  
  68. ColorSecondary.MouseButton1Down:connect(Opposite)
  69. ColorPrimary.MouseButton1Down:connect(Opposite)
  70.  
  71. PaletteGui = Instance.new("Frame", Color)
  72. PaletteGui.BackgroundColor3 = Color3.new(0.45, 0.45, 0.45)
  73. PaletteGui.BackgroundTransparency = 0.4
  74. PaletteGui.Size = UDim2.new(0, 170, 0, 165)
  75. PaletteGui.Position = UDim2.new(0, 15, 1, -175)
  76.  
  77. local xx = 0
  78. local yy = 0
  79. for _, v in pairs(Palette) do
  80. local G = Instance.new("ImageButton", PaletteGui)
  81. G.Size = UDim2.new(0, 18, 0, 18)
  82. G.Position = UDim2.new(0, xx+6, 0, yy+5)
  83. G.AutoButtonColor = false
  84. G.BorderSizePixel = 0
  85. G.BackgroundColor3 = v.Color
  86. G.MouseButton1Down:connect(function()
  87. Primary = v.Color
  88. ColorPrimary.BackgroundColor3 = v.Color
  89. end)
  90. G.MouseButton2Down:connect(function()
  91. Secondary = v.Color
  92. ColorSecondary.BackgroundColor3 = v.Color
  93. end)
  94. xx = xx + 20
  95. if xx >= 160 then xx = 0 yy = yy + 20 end
  96. end
  97.  
  98. Clear = Instance.new("TextButton", Color)
  99. Clear.Size = UDim2.new(0, 100, 0, 30)
  100. Clear.Position = UDim2.new(0, 80, 0, 30)
  101. Clear.AutoButtonColor = false
  102. Clear.BackgroundColor3 = Color3.new()
  103. Clear.BorderColor3 = Color3.new(1,1,1)
  104. Clear.Text = "Clear"
  105. Clear.Font = "ArialBold"
  106. Clear.FontSize = Enum.FontSize.Size24
  107. Clear.TextColor3 = Color3.new(1,1,1)
  108. Clear.MouseButton1Down:connect(function()
  109. for _,v in pairs(Lines) do
  110. for _,k in pairs(v[1]) do
  111. k:remove()
  112. end
  113. end
  114. for _,v in pairs(Lines) do
  115. table.remove(Lines, 1)
  116. end
  117. end)
  118.  
  119. for y = 10, Size-10, 20 do
  120. for x = 10, Size-10, 20 do
  121. local x = x-(Size/2)
  122. local y = y-(Size/2)
  123. local P = Instance.new("Frame", Screen)
  124. P.BorderSizePixel = 0
  125. P.BackgroundColor3 = Color3.new()
  126. P.BackgroundTransparency = 0.5
  127. P.Size = UDim2.new(0, 3, 0, 3)
  128. P.Position = UDim2.new(0, x+(Size/2), 0, y+(Size/2))
  129. table.insert(Dots, Vector2.new(x, y))
  130. end
  131. end
  132.  
  133. function DrawLine(Start, End, Color, add)
  134. local unit = -(Start-End).unit
  135. local magnitude = (Start-End).magnitude
  136. local parts = {}
  137. for i = 0, magnitude, 2 do
  138. local P = Instance.new("Frame", Screen)
  139. P.BorderSizePixel = 0
  140. P.BackgroundColor3 = Color
  141. P.Size = UDim2.new(0, 3, 0, 3)
  142. P.Position = UDim2.new(0, Size/2+Start.x, 0, Size/2+Start.y) + UDim2.new(0, unit.x*i, 0, unit.y*i)
  143. table.insert(parts, P)
  144. end
  145. local tab = {parts, unit = unit, magnitude = magnitude}
  146. if add then
  147. table.insert(Lines, tab)
  148. end
  149. return tab
  150. end
  151.  
  152. function GetClosest(Poss)
  153. local Res = GetResolution()/2
  154. local Pos = Poss-Res
  155. local Closest = Vector2.new(0, 0)
  156. local Magn = math.huge
  157. for _, v in pairs(Dots) do
  158. local magn = (v-Pos).magnitude
  159. if magn < Magn then
  160. Closest = v
  161. Magn = magn
  162. end
  163. end
  164. return Closest
  165. end
  166.  
  167. Screen.MouseButton1Down:connect(function(x,y)
  168. local Pos1 = GetClosest(Vector2.new(x,y))
  169. local prev = nil
  170. local c = Screen.MouseButton1Up:connect(function(x2, y2)
  171. local Pos2 = GetClosest(Vector2.new(x2,y2))
  172. if Pos2 ~= Pos1 then
  173. DrawLine(Pos1, Pos2, Primary, true)
  174. end
  175. c:disconnect()
  176. if prev then
  177. for _,v in pairs(prev[1]) do
  178. v:remove()
  179. end
  180. end
  181. end)
  182. end)
  183.  
  184. Screen.MouseButton2Down:connect(function(x,y)
  185. local Pos1 = GetClosest(Vector2.new(x,y))
  186. local c = Screen.MouseButton2Up:connect(function(x2, y2)
  187. local Pos2 = GetClosest(Vector2.new(x2,y2))
  188. if Pos2 ~= Pos1 then
  189. DrawLine(Pos1, Pos2, Secondary, true)
  190. end
  191. c:disconnect()
  192. end)
  193. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement