Advertisement
BobBillJones

im suffering

Mar 30th, 2022
768
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.99 KB | None | 0 0
  1. local collectionService = game:GetService("CollectionService")
  2.  
  3. local player = game.Players.LocalPlayer
  4.  
  5. _G.refreshing = true
  6.  
  7. local cloneGui = {}
  8.  
  9.  
  10.  
  11. function cloneGui.buildRoot()
  12.  
  13. local paintFrame = player.PlayerGui.MainGui.PaintFrame
  14.  
  15. local cloneFrame = paintFrame:Clone()
  16.  
  17.  
  18.  
  19. -- Initialize root frame.
  20.  
  21. cloneFrame.Name = 'CloneFrame'
  22.  
  23. cloneFrame.Parent = paintFrame
  24.  
  25. cloneFrame.ToolsFrame:Destroy()
  26.  
  27. cloneFrame.ColorFrame:Destroy()
  28.  
  29. cloneFrame.NextButton:Destroy()
  30.  
  31. cloneFrame.UIAspectRatioConstraint:Destroy()
  32.  
  33. cloneFrame.Grid:Destroy()
  34.  
  35. cloneFrame.Confirmation:Destroy()
  36.  
  37. cloneFrame.AnchorPoint = Vector2.new(0, 0.5)
  38.  
  39. cloneFrame.Position = UDim2.new(1, 10, 0.5, 0)
  40.  
  41. cloneFrame.Size = UDim2.new(0.5, 0, 1, 0)
  42.  
  43. cloneFrame.Visible = true
  44.  
  45.  
  46.  
  47. paintFrame.Position = UDim2.new(0.5, -((cloneFrame.AbsoluteSize.X / 2) + 5), 0.5, 0)
  48.  
  49.  
  50.  
  51. cloneGui.root = cloneFrame
  52.  
  53. end
  54.  
  55.  
  56.  
  57. function cloneGui.buildButtons()
  58.  
  59. local nextButton = player.PlayerGui.MainGui.PaintFrame.NextButton
  60.  
  61. local copyButton = nextButton:Clone()
  62.  
  63. local cloneButton = nextButton:Clone()
  64.  
  65. local buttonSize = UDim2.new(0.4, 0, 0.09, 0)
  66.  
  67.  
  68.  
  69. -- Initialize copy button.
  70.  
  71. copyButton.Parent = cloneGui.root
  72.  
  73. copyButton.Size = buttonSize
  74.  
  75. copyButton.Position = UDim2.new(0.28, 0, 0.895)
  76.  
  77. copyButton.Label.Text = 'COPY'
  78.  
  79. copyButton.Name = 'CopyButton'
  80.  
  81.  
  82.  
  83. -- Initialize clone button.
  84.  
  85. cloneButton.Parent = cloneGui.root
  86.  
  87. cloneButton.Size = buttonSize
  88.  
  89. cloneButton.Position = UDim2.new(0.72, 0, 0.895)
  90.  
  91. cloneButton.Label.Text = 'CLONE'
  92.  
  93. cloneButton.Name = 'CloneButton'
  94.  
  95.  
  96.  
  97. -- Animation functions.
  98.  
  99. for i, button in pairs({cloneButton, copyButton}) do
  100.  
  101. button.MouseEnter:Connect(function()
  102.  
  103. button:TweenSize(UDim2.new(buttonSize.X.Scale + 0.015, 0, buttonSize.Y.Scale + 0.015, 0), 'Out', 'Quad', 0.2, true)
  104.  
  105. end)
  106.  
  107.  
  108.  
  109. button.MouseLeave:Connect(function()
  110.  
  111. button:TweenSize(buttonSize, 'Out', 'Quad', 0.2, true)
  112.  
  113. end)
  114.  
  115. end
  116.  
  117.  
  118.  
  119. -- Button actions.
  120.  
  121. copyButton.MouseButton1Click:Connect(copyGrid)
  122.  
  123.  
  124.  
  125. cloneButton.MouseButton1Click:Connect(cloneGrid)
  126.  
  127. end
  128.  
  129.  
  130.  
  131. function cloneGui.buildScrollingFrame()
  132.  
  133. local scrollingFrame = Instance.new('ScrollingFrame')
  134.  
  135. local uiListLayout = Instance.new('UIListLayout')
  136.  
  137. local uiPadding = Instance.new('UIPadding')
  138.  
  139.  
  140.  
  141. -- Initialize scrolling frame.
  142.  
  143. scrollingFrame.Parent = cloneGui.root
  144.  
  145. scrollingFrame.AnchorPoint = Vector2.new(0.5, 0)
  146.  
  147. scrollingFrame.Position = UDim2.new(0.5, 0, 0.05, 0)
  148.  
  149. scrollingFrame.Size = UDim2.new(0.8, 0, 0.75, 0)
  150.  
  151. scrollingFrame.BackgroundTransparency = 1
  152.  
  153. scrollingFrame.BorderSizePixel = 0
  154.  
  155. scrollingFrame.ScrollBarImageColor3 = Color3.new((210 / 255), (76 / 255), (71 / 255))
  156.  
  157. scrollingFrame.ScrollBarThickness = 4
  158.  
  159. scrollingFrame.ZIndex = 3
  160.  
  161.  
  162.  
  163. -- Configure layout.
  164.  
  165. uiListLayout.Parent = scrollingFrame
  166.  
  167. uiListLayout.Padding = UDim.new(0, 10)
  168.  
  169. uiPadding.Parent = scrollingFrame
  170.  
  171. uiPadding.PaddingLeft = UDim.new(0.08, 0)
  172.  
  173. uiPadding.PaddingRight = UDim.new(0.08, 0)
  174.  
  175. uiPadding.PaddingTop = UDim.new(0, 5)
  176.  
  177.  
  178.  
  179. uiListLayout.Changed:Connect(function()
  180.  
  181. scrollingFrame.CanvasSize = UDim2.new(0, 0, 0, uiListLayout.AbsoluteContentSize.Y + 10)
  182.  
  183. end)
  184.  
  185.  
  186.  
  187. cloneGui.scrollingFrame = scrollingFrame
  188.  
  189. end
  190.  
  191.  
  192.  
  193. function cloneGui.addGrid(grid)
  194.  
  195. local UIStroke = player.PlayerGui.MainGui.PaintFrame.Grid.UIStroke:Clone()
  196.  
  197. local container = Instance.new('Frame')
  198.  
  199. local preview = grid:Clone()
  200.  
  201.  
  202.  
  203. -- Initialize new container.
  204.  
  205. container.Parent = cloneGui.scrollingFrame
  206.  
  207. container.Size = UDim2.new(1, 0, 1, 0)
  208.  
  209. container.SizeConstraint = Enum.SizeConstraint.RelativeXX
  210.  
  211. container.BackgroundTransparency = 0.8
  212.  
  213. container.ZIndex = 4
  214.  
  215. UIStroke.Thickness = 4.5
  216.  
  217. UIStroke.Parent = container
  218.  
  219. UIStroke.Enabled = false
  220.  
  221.  
  222.  
  223. -- Clone grid into container.
  224.  
  225. preview.Parent = container
  226.  
  227.  
  228.  
  229. if (cloneGui.selected == nil) then
  230.  
  231. cloneGui.selected = container
  232.  
  233. UIStroke.Enabled = true
  234.  
  235. end
  236.  
  237.  
  238.  
  239. container.InputBegan:Connect(function(userInput)
  240.  
  241. if (userInput.UserInputType == Enum.UserInputType.MouseButton1) then
  242.  
  243. cloneGui.selected.UIStroke.Enabled = false
  244.  
  245. UIStroke.Enabled = true
  246.  
  247. cloneGui.selected = container
  248.  
  249. end
  250.  
  251. end)
  252.  
  253. end
  254.  
  255.  
  256.  
  257. function copyGrid()
  258.  
  259. if (cloneGui.selected ~= nil) then
  260.  
  261. local target = cloneGui.selected.Grid
  262.  
  263. local destination = player.PlayerGui.MainGui.PaintFrame.Grid
  264.  
  265.  
  266.  
  267. for i = 1, 1024 do
  268.  
  269. destination[i].BackgroundColor3 = target[i].BackgroundColor3
  270.  
  271. end
  272.  
  273. end
  274.  
  275. end
  276.  
  277.  
  278.  
  279. function cloneGrid()
  280.  
  281. local remote = game.ReplicatedStorage.Remotes.CreateArt
  282.  
  283. local frameColor = "ffffff"
  284.  
  285. local frame = "Starter Frame"
  286.  
  287. local name = "a"
  288.  
  289. local cells = {}
  290.  
  291.  
  292.  
  293. local grid = cloneGui.selected.Grid
  294.  
  295. for i = 1, 1024 do
  296.  
  297. cells[i] = grid[i].BackgroundColor3:ToHex()
  298.  
  299. end
  300.  
  301.  
  302.  
  303. local payload = {}
  304.  
  305. payload["FrameColor"] = frameColor
  306.  
  307. payload["Frame"] = frame
  308.  
  309. payload["Name"] = name
  310.  
  311. payload["Cells"] = cells
  312.  
  313.  
  314.  
  315. remote:InvokeServer(payload)
  316.  
  317. end
  318.  
  319.  
  320.  
  321. function refreshGrids()
  322.  
  323. local objects = game.Workspace.Plots:GetDescendants()
  324.  
  325. for i, v in ipairs(objects) do
  326.  
  327. if (v.Name == 'Grid' and v.ClassName == 'Frame' and not collectionService:HasTag(v, 'cloned')) then
  328.  
  329. if (#v:GetChildren() == 1027) then
  330.  
  331. collectionService:AddTag(v, 'cloned')
  332.  
  333. cloneGui.addGrid(v)
  334.  
  335. end
  336.  
  337. end
  338.  
  339. end
  340.  
  341. end
  342.  
  343.  
  344.  
  345. cloneGui.buildRoot()
  346.  
  347. cloneGui.buildButtons()
  348.  
  349. cloneGui.buildScrollingFrame()
  350.  
  351.  
  352.  
  353. while (_G.refreshing) do
  354.  
  355. refreshGrids()
  356.  
  357. wait(0.1)
  358.  
  359. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement