Advertisement
M0nkePr0

Bracket V3 Modified

Oct 14th, 2022 (edited)
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.88 KB | Fixit | 0 0
  1. local Library = {Toggle = true,FirstTab = nil,TabCount = 0,ColorTable = {}}
  2.  
  3. local RunService = game:GetService("RunService")
  4. local HttpService = game:GetService("HttpService")
  5. local TweenService = game:GetService("TweenService")
  6. local UserInputService = game:GetService("UserInputService")
  7.  
  8. local function MakeDraggable(ClickObject, Object)
  9. local Dragging = nil
  10. local DragInput = nil
  11. local DragStart = nil
  12. local StartPosition = nil
  13.  
  14. ClickObject.InputBegan:Connect(function(Input)
  15. if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.UserInputType == Enum.UserInputType.Touch then
  16. Dragging = true
  17. DragStart = Input.Position
  18. StartPosition = Object.Position
  19.  
  20. Input.Changed:Connect(function()
  21. if Input.UserInputState == Enum.UserInputState.End then
  22. Dragging = false
  23. end
  24. end)
  25. end
  26. end)
  27.  
  28. ClickObject.InputChanged:Connect(function(Input)
  29. if Input.UserInputType == Enum.UserInputType.MouseMovement or Input.UserInputType == Enum.UserInputType.Touch then
  30. DragInput = Input
  31. end
  32. end)
  33.  
  34. UserInputService.InputChanged:Connect(function(Input)
  35. if Input == DragInput and Dragging then
  36. local Delta = Input.Position - DragStart
  37. Object.Position = UDim2.new(StartPosition.X.Scale, StartPosition.X.Offset + Delta.X, StartPosition.Y.Scale, StartPosition.Y.Offset + Delta.Y)
  38. end
  39. end)
  40. end
  41.  
  42. function Library:CreateWindow(Config, Parent)
  43. local WindowInit = {}
  44. local Folder = game:GetObjects("rbxassetid://11276391958")[1]
  45. local Screen = Folder.Bracket:Clone()
  46. local Main = Screen.Main
  47. local Holder = Main.Holder
  48. local Topbar = Main.Topbar
  49. local TContainer = Holder.TContainer
  50. local TBContainer = Holder.TBContainer.Holder
  51. local dt = DateTime.now()
  52. --[[
  53. -- idk probably fix for exploits that dont have this function
  54. if syn and syn.protect_gui then
  55. syn.protect_gui(Screen)
  56. end
  57. ]]
  58.  
  59. Screen.Name = HttpService:GenerateGUID(false)
  60. Screen.Parent = Parent
  61. Topbar.WindowName.Text = Config.WindowName
  62. Topbar.LibraryName.Text = dt:FormatLocalTime("LL", "en-us")
  63.  
  64. MakeDraggable(Topbar,Main)
  65. local function CloseAll()
  66. for _,Tab in pairs(TContainer:GetChildren()) do
  67. if Tab:IsA("ScrollingFrame") then
  68. Tab.Visible = false
  69. end
  70. end
  71. end
  72. local function ResetAll()
  73. for _,TabButton in pairs(TBContainer:GetChildren()) do
  74. if TabButton:IsA("TextButton") then
  75. TabButton.BackgroundTransparency = 1
  76. end
  77. end
  78. for _,TabButton in pairs(TBContainer:GetChildren()) do
  79. if TabButton:IsA("TextButton") then
  80. TabButton.Size = UDim2.new(0,480 / Library.TabCount,1,0)
  81. end
  82. end
  83. for _,Pallete in pairs(Screen:GetChildren()) do
  84. if Pallete:IsA("Frame") and Pallete.Name ~= "Main" then
  85. Pallete.Visible = false
  86. end
  87. end
  88. end
  89. local function KeepFirst()
  90. for _,Tab in pairs(TContainer:GetChildren()) do
  91. if Tab:IsA("ScrollingFrame") then
  92. if Tab.Name == Library.FirstTab .. " T" then
  93. Tab.Visible = true
  94. else
  95. Tab.Visible = false
  96. end
  97. end
  98. end
  99. for _,TabButton in pairs(TBContainer:GetChildren()) do
  100. if TabButton:IsA("TextButton") then
  101. if TabButton.Name == Library.FirstTab .. " TB" then
  102. TabButton.BackgroundTransparency = 0
  103. else
  104. TabButton.BackgroundTransparency = 1
  105. end
  106. end
  107. end
  108. end
  109. local function Toggle(State)
  110. if State then
  111. Main.Visible = true
  112. elseif not State then
  113. for _,Pallete in pairs(Screen:GetChildren()) do
  114. if Pallete:IsA("Frame") and Pallete.Name ~= "Main" then
  115. Pallete.Visible = false
  116. end
  117. end
  118. Screen.ToolTip.Visible = false
  119. Main.Visible = false
  120. end
  121. Library.Toggle = State
  122. end
  123. local function ChangeColor(Color)
  124. Config.Color = Color
  125. for i, v in pairs(Library.ColorTable) do
  126. if v.BackgroundColor3 ~= Color3.fromRGB(50, 50, 50) then
  127. v.BackgroundColor3 = Color
  128. end
  129. end
  130. end
  131.  
  132. function WindowInit:Toggle(State)
  133. Toggle(State)
  134. end
  135.  
  136. function WindowInit:ChangeColor(Color)
  137. ChangeColor(Color)
  138. end
  139.  
  140. function WindowInit:SetBackground(ImageId)
  141. Holder.Image = "rbxassetid://" .. ImageId
  142. end
  143.  
  144. function WindowInit:SetBackgroundColor(Color)
  145. Holder.ImageColor3 = Color
  146. end
  147. function WindowInit:SetBackgroundTransparency(Transparency)
  148. Holder.ImageTransparency = Transparency
  149. end
  150.  
  151. function WindowInit:SetTileOffset(Offset)
  152. Holder.TileSize = UDim2.new(0,Offset,0,Offset)
  153. end
  154. function WindowInit:SetTileScale(Scale)
  155. Holder.TileSize = UDim2.new(Scale,0,Scale,0)
  156. end
  157.  
  158. RunService.RenderStepped:Connect(function()
  159. if Library.Toggle then
  160. Screen.ToolTip.Position = UDim2.new(0,UserInputService:GetMouseLocation().X + 10,0,UserInputService:GetMouseLocation().Y - 5)
  161. end
  162. end)
  163.  
  164. function WindowInit:CreateTab(Name)
  165. local TabInit = {}
  166. local Tab = Folder.Tab:Clone()
  167. local TabButton = Folder.TabButton:Clone()
  168.  
  169. Tab.Name = Name .. " T"
  170. Tab.Parent = TContainer
  171.  
  172. TabButton.Name = Name .. " TB"
  173. TabButton.Parent = TBContainer
  174. TabButton.Title.Text = Name
  175. TabButton.BackgroundColor3 = Config.Color
  176.  
  177. table.insert(Library.ColorTable, TabButton)
  178. Library.TabCount = Library.TabCount + 1
  179. if Library.TabCount == 1 then
  180. Library.FirstTab = Name
  181. end
  182.  
  183. CloseAll()
  184. ResetAll()
  185. KeepFirst()
  186.  
  187. local function GetSide(Longest)
  188. if Longest then
  189. if Tab.LeftSide.ListLayout.AbsoluteContentSize.Y > Tab.RightSide.ListLayout.AbsoluteContentSize.Y then
  190. return Tab.LeftSide
  191. else
  192. return Tab.RightSide
  193. end
  194. else
  195. if Tab.LeftSide.ListLayout.AbsoluteContentSize.Y > Tab.RightSide.ListLayout.AbsoluteContentSize.Y then
  196. return Tab.RightSide
  197. else
  198. return Tab.LeftSide
  199. end
  200. end
  201. end
  202.  
  203. TabButton.MouseButton1Click:Connect(function()
  204. CloseAll()
  205. ResetAll()
  206. Tab.Visible = true
  207. TabButton.BackgroundTransparency = 0
  208. end)
  209.  
  210. Tab.LeftSide.ListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
  211. if GetSide(true).Name == Tab.LeftSide.Name then
  212. Tab.CanvasSize = UDim2.new(0,0,0,Tab.LeftSide.ListLayout.AbsoluteContentSize.Y + 15)
  213. else
  214. Tab.CanvasSize = UDim2.new(0,0,0,Tab.RightSide.ListLayout.AbsoluteContentSize.Y + 15)
  215. end
  216. end)
  217. Tab.RightSide.ListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
  218. if GetSide(true).Name == Tab.LeftSide.Name then
  219. Tab.CanvasSize = UDim2.new(0,0,0,Tab.LeftSide.ListLayout.AbsoluteContentSize.Y + 15)
  220. else
  221. Tab.CanvasSize = UDim2.new(0,0,0,Tab.RightSide.ListLayout.AbsoluteContentSize.Y + 15)
  222. end
  223. end)
  224.  
  225. function TabInit:CreateSection(Name)
  226. local SectionInit = {}
  227. local Section = Folder.Section:Clone()
  228. Section.Name = Name .. " S"
  229. Section.Parent = GetSide(false)
  230.  
  231. Section.Title.Text = Name
  232. Section.Title.Size = UDim2.new(0,Section.Title.TextBounds.X + 10,0,2)
  233.  
  234. Section.Container.ListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
  235. Section.Size = UDim2.new(1,0,0,Section.Container.ListLayout.AbsoluteContentSize.Y + 15)
  236. end)
  237.  
  238. function SectionInit:CreateLabel(Name)
  239. local LabelInit = {}
  240. local Label = Folder.Label:Clone()
  241. Label.Name = Name .. " L"
  242. Label.Parent = Section.Container
  243. Label.Text = Name
  244. Label.Size = UDim2.new(1,-10,0,Label.TextBounds.Y)
  245. function LabelInit:UpdateText(Text)
  246. Label.Text = Text
  247. Label.Size = UDim2.new(1,-10,0,Label.TextBounds.Y)
  248. end
  249. return LabelInit
  250. end
  251. function SectionInit:CreateButton(Name, Callback)
  252. local ButtonInit = {}
  253. local Button = Folder.Button:Clone()
  254. Button.Name = Name .. " B"
  255. Button.Parent = Section.Container
  256. Button.Title.Text = Name
  257. Button.Size = UDim2.new(1,-10,0,Button.Title.TextBounds.Y + 5)
  258. table.insert(Library.ColorTable, Button)
  259.  
  260. Button.MouseButton1Down:Connect(function()
  261. Button.BackgroundColor3 = Config.Color
  262. end)
  263.  
  264. Button.MouseButton1Up:Connect(function()
  265. Button.BackgroundColor3 = Color3.fromRGB(50,50,50)
  266. end)
  267.  
  268. Button.MouseLeave:Connect(function()
  269. Button.BackgroundColor3 = Color3.fromRGB(50,50,50)
  270. end)
  271.  
  272. Button.MouseButton1Click:Connect(function()
  273. Callback()
  274. end)
  275.  
  276. function ButtonInit:AddToolTip(Name)
  277. if tostring(Name):gsub(" ", "") ~= "" then
  278. Button.MouseEnter:Connect(function()
  279. Screen.ToolTip.Text = Name
  280. Screen.ToolTip.Size = UDim2.new(0,Screen.ToolTip.TextBounds.X + 5,0,Screen.ToolTip.TextBounds.Y + 5)
  281. Screen.ToolTip.Visible = true
  282. end)
  283.  
  284. Button.MouseLeave:Connect(function()
  285. Screen.ToolTip.Visible = false
  286. end)
  287. end
  288. end
  289.  
  290. return ButtonInit
  291. end
  292. function SectionInit:CreateTextBox(Name, PlaceHolder, NumbersOnly, Callback)
  293. local TextBoxInit = {}
  294. local TextBox = Folder.TextBox:Clone()
  295. TextBox.Name = Name .. " T"
  296. TextBox.Parent = Section.Container
  297. TextBox.Title.Text = Name
  298. TextBox.Title.Font = Enum.Font.Jura
  299. TextBox.Background.Input.PlaceholderText = PlaceHolder
  300. TextBox.Title.Size = UDim2.new(1,0,0,TextBox.Title.TextBounds.Y + 5)
  301. TextBox.Size = UDim2.new(1,-10,0,TextBox.Title.TextBounds.Y + 25)
  302.  
  303. TextBox.Background.Input.FocusLost:Connect(function()
  304. if NumbersOnly and not tonumber(TextBox.Background.Input.Text) then
  305. Callback(tonumber(TextBox.Background.Input.Text))
  306. --TextBox.Background.Input.Text = ""
  307. else
  308. Callback(TextBox.Background.Input.Text)
  309. --TextBox.Background.Input.Text = ""
  310. end
  311. end)
  312. function TextBoxInit:SetValue(String)
  313. Callback(String)
  314. TextBox.Background.Input.Text = String
  315. end
  316. function TextBoxInit:AddToolTip(Name)
  317. if tostring(Name):gsub(" ", "") ~= "" then
  318. TextBox.MouseEnter:Connect(function()
  319. Screen.ToolTip.Text = Name
  320. Screen.ToolTip.Size = UDim2.new(0,Screen.ToolTip.TextBounds.X + 5,0,Screen.ToolTip.TextBounds.Y + 5)
  321. Screen.ToolTip.Visible = true
  322. end)
  323.  
  324. TextBox.MouseLeave:Connect(function()
  325. Screen.ToolTip.Visible = false
  326. end)
  327. end
  328. end
  329. return TextBoxInit
  330. end
  331. function SectionInit:CreateToggle(Name, Default, Callback)
  332. local DefaultLocal = Default or false
  333. local ToggleInit = {}
  334. local Toggle = Folder.Toggle:Clone()
  335. Toggle.Name = Name .. " T"
  336. Toggle.Parent = Section.Container
  337. Toggle.Title.Text = Name
  338. Toggle.Size = UDim2.new(1,-10,0,Toggle.Title.TextBounds.Y + 5)
  339.  
  340. table.insert(Library.ColorTable, Toggle.Toggle)
  341. local ToggleState = false
  342.  
  343. local function SetState(State)
  344. if State then
  345. Toggle.Toggle.BackgroundColor3 = Config.Color
  346. elseif not State then
  347. Toggle.Toggle.BackgroundColor3 = Color3.fromRGB(50,50,50)
  348. end
  349. ToggleState = State
  350. Callback(State)
  351. end
  352.  
  353. Toggle.MouseButton1Click:Connect(function()
  354. ToggleState = not ToggleState
  355. SetState(ToggleState)
  356. end)
  357.  
  358. function ToggleInit:AddToolTip(Name)
  359. if tostring(Name):gsub(" ", "") ~= "" then
  360. Toggle.MouseEnter:Connect(function()
  361. Screen.ToolTip.Text = Name
  362. Screen.ToolTip.Size = UDim2.new(0,Screen.ToolTip.TextBounds.X + 5,0,Screen.ToolTip.TextBounds.Y + 5)
  363. Screen.ToolTip.Visible = true
  364. end)
  365.  
  366. Toggle.MouseLeave:Connect(function()
  367. Screen.ToolTip.Visible = false
  368. end)
  369. end
  370. end
  371.  
  372. if Default == nil then
  373. function ToggleInit:SetState(State)
  374. SetState(State)
  375. end
  376. else
  377. SetState(DefaultLocal)
  378. end
  379.  
  380. function ToggleInit:GetState(State)
  381. return ToggleState
  382. end
  383.  
  384. function ToggleInit:CreateKeybind(Bind,Callback)
  385. local KeybindInit = {}
  386. Bind = Bind or "NONE"
  387.  
  388. local WaitingForBind = false
  389. local Selected = Bind
  390. local Blacklist = {"W","A","S","D","Slash","Tab","Backspace","Escape","Space","Delete","Unknown","Backquote"}
  391.  
  392. Toggle.Keybind.Visible = true
  393. Toggle.Keybind.Text = "[ " .. Bind .. " ]"
  394.  
  395. Toggle.Keybind.MouseButton1Click:Connect(function()
  396. Toggle.Keybind.Text = "[ ... ]"
  397. WaitingForBind = true
  398. end)
  399.  
  400. Toggle.Keybind:GetPropertyChangedSignal("TextBounds"):Connect(function()
  401. Toggle.Keybind.Size = UDim2.new(0,Toggle.Keybind.TextBounds.X,1,0)
  402. Toggle.Title.Size = UDim2.new(1,-Toggle.Keybind.Size.X.Offset - 15,1,0)
  403. end)
  404.  
  405. UserInputService.InputBegan:Connect(function(Input)
  406. if WaitingForBind and Input.UserInputType == Enum.UserInputType.Keyboard then
  407. local Key = tostring(Input.KeyCode):gsub("Enum.KeyCode.", "")
  408. if not table.find(Blacklist, Key) then
  409. Toggle.Keybind.Text = "[ " .. Key .. " ]"
  410. Selected = Key
  411. else
  412. Toggle.Keybind.Text = "[ NONE ]"
  413. Selected = "NONE"
  414. end
  415. WaitingForBind = false
  416. elseif Input.UserInputType == Enum.UserInputType.Keyboard then
  417. local Key = tostring(Input.KeyCode):gsub("Enum.KeyCode.", "")
  418. if Key == Selected then
  419. ToggleState = not ToggleState
  420. SetState(ToggleState)
  421. if Callback then
  422. Callback(Key)
  423. end
  424. end
  425. end
  426. end)
  427.  
  428. function KeybindInit:SetBind(Key)
  429. Toggle.Keybind.Text = "[ " .. Key .. " ]"
  430. Selected = Key
  431. end
  432.  
  433. function KeybindInit:GetBind()
  434. return Selected
  435. end
  436.  
  437. return KeybindInit
  438. end
  439. return ToggleInit
  440. end
  441. function SectionInit:CreateSlider(Name, Min, Max, Default, Precise, Callback)
  442. local DefaultLocal = Default or 50
  443. local SliderInit = {}
  444. local Slider = Folder.Slider:Clone()
  445. Slider.Name = Name .. " S"
  446. Slider.Parent = Section.Container
  447.  
  448. Slider.Title.Text = Name
  449. Slider.Slider.Bar.Size = UDim2.new(Min / Max,0,1,0)
  450. Slider.Slider.Bar.BackgroundColor3 = Config.Color
  451. Slider.Value.PlaceholderText = tostring(Min / Max)
  452. Slider.Title.Size = UDim2.new(1,0,0,Slider.Title.TextBounds.Y + 5)
  453. Slider.Size = UDim2.new(1,-10,0,Slider.Title.TextBounds.Y + 15)
  454. table.insert(Library.ColorTable, Slider.Slider.Bar)
  455.  
  456. local GlobalSliderValue = 0
  457. local Dragging = false
  458. local function Sliding(Input)
  459. local Position = UDim2.new(math.clamp((Input.Position.X - Slider.Slider.AbsolutePosition.X) / Slider.Slider.AbsoluteSize.X,0,1),0,1,0)
  460. Slider.Slider.Bar.Size = Position
  461. local SliderPrecise = ((Position.X.Scale * Max) / Max) * (Max - Min) + Min
  462. local SliderNonPrecise = math.floor(((Position.X.Scale * Max) / Max) * (Max - Min) + Min)
  463. local SliderValue = Precise and SliderNonPrecise or SliderPrecise
  464. SliderValue = tonumber(string.format("%.2f", SliderValue))
  465. GlobalSliderValue = SliderValue
  466. Slider.Value.PlaceholderText = tostring(SliderValue)
  467. Callback(GlobalSliderValue)
  468. end
  469. local function SetValue(Value)
  470. GlobalSliderValue = Value
  471. Slider.Slider.Bar.Size = UDim2.new(Value / Max,0,1,0)
  472. Slider.Value.PlaceholderText = Value
  473. Callback(Value)
  474. end
  475. Slider.Value.FocusLost:Connect(function()
  476. if not tonumber(Slider.Value.Text) then
  477. Slider.Value.Text = GlobalSliderValue
  478. elseif Slider.Value.Text == "" or tonumber(Slider.Value.Text) <= Min then
  479. Slider.Value.Text = Min
  480. elseif Slider.Value.Text == "" or tonumber(Slider.Value.Text) >= Max then
  481. Slider.Value.Text = Max
  482. end
  483.  
  484. GlobalSliderValue = Slider.Value.Text
  485. Slider.Slider.Bar.Size = UDim2.new(Slider.Value.Text / Max,0,1,0)
  486. Slider.Value.PlaceholderText = Slider.Value.Text
  487. Callback(tonumber(Slider.Value.Text))
  488. Slider.Value.Text = ""
  489. end)
  490.  
  491. Slider.InputBegan:Connect(function(Input)
  492. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  493. Sliding(Input)
  494. Dragging = true
  495. end
  496. end)
  497.  
  498. Slider.InputEnded:Connect(function(Input)
  499. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  500. Dragging = false
  501. end
  502. end)
  503.  
  504. UserInputService.InputBegan:Connect(function(Input)
  505. if Input.KeyCode == Enum.KeyCode.LeftControl then
  506. Slider.Value.ZIndex = 4
  507. end
  508. end)
  509.  
  510. UserInputService.InputEnded:Connect(function(Input)
  511. if Input.KeyCode == Enum.KeyCode.LeftControl then
  512. Slider.Value.ZIndex = 3
  513. end
  514. end)
  515.  
  516. UserInputService.InputChanged:Connect(function(Input)
  517. if Dragging and Input.UserInputType == Enum.UserInputType.MouseMovement then
  518. Sliding(Input)
  519. end
  520. end)
  521.  
  522. function SliderInit:AddToolTip(Name)
  523. if tostring(Name):gsub(" ", "") ~= "" then
  524. Slider.MouseEnter:Connect(function()
  525. Screen.ToolTip.Text = Name
  526. Screen.ToolTip.Size = UDim2.new(0,Screen.ToolTip.TextBounds.X + 5,0,Screen.ToolTip.TextBounds.Y + 5)
  527. Screen.ToolTip.Visible = true
  528. end)
  529.  
  530. Slider.MouseLeave:Connect(function()
  531. Screen.ToolTip.Visible = false
  532. end)
  533. end
  534. end
  535.  
  536. if Default == nil then
  537. function SliderInit:SetValue(Value)
  538. GlobalSliderValue = Value
  539. Slider.Slider.Bar.Size = UDim2.new(Value / Max,0,1,0)
  540. Slider.Value.PlaceholderText = Value
  541. Callback(Value)
  542. end
  543. else
  544. SetValue(DefaultLocal)
  545. end
  546.  
  547. function SliderInit:GetValue(Value)
  548. return GlobalSliderValue
  549. end
  550.  
  551. return SliderInit
  552. end
  553. function SectionInit:CreateDropdown(Name, OptionTable, Callback, InitialValue)
  554. local DropdownInit = {}
  555. local Dropdown = Folder.Dropdown:Clone()
  556. Dropdown.Name = Name .. " D"
  557. Dropdown.Parent = Section.Container
  558.  
  559. Dropdown.Title.Text = Name
  560. Dropdown.Title.Size = UDim2.new(1,0,0,Dropdown.Title.TextBounds.Y + 5)
  561. Dropdown.Container.Position = UDim2.new(0,0,0,Dropdown.Title.TextBounds.Y + 5)
  562. Dropdown.Size = UDim2.new(1,-10,0,Dropdown.Title.TextBounds.Y + 25)
  563.  
  564. local DropdownToggle = false
  565.  
  566. Dropdown.MouseButton1Click:Connect(function()
  567. DropdownToggle = not DropdownToggle
  568. if DropdownToggle then
  569. Dropdown.Size = UDim2.new(1,-10,0,Dropdown.Container.Holder.Container.ListLayout.AbsoluteContentSize.Y + Dropdown.Title.TextBounds.Y + 30)
  570. Dropdown.Container.Holder.Visible = true
  571. else
  572. Dropdown.Size = UDim2.new(1,-10,0,Dropdown.Title.TextBounds.Y + 25)
  573. Dropdown.Container.Holder.Visible = false
  574. end
  575. end)
  576.  
  577. for _,OptionName in pairs(OptionTable) do
  578. local Option = Folder.Option:Clone()
  579. Option.Name = OptionName
  580. Option.Parent = Dropdown.Container.Holder.Container
  581.  
  582. Option.Title.Text = OptionName
  583. Option.BackgroundColor3 = Config.Color
  584. Option.Size = UDim2.new(1,0,0,Option.Title.TextBounds.Y + 5)
  585. Dropdown.Container.Holder.Size = UDim2.new(1,-5,0,Dropdown.Container.Holder.Container.ListLayout.AbsoluteContentSize.Y)
  586. table.insert(Library.ColorTable, Option)
  587.  
  588. Option.MouseButton1Down:Connect(function()
  589. Option.BackgroundTransparency = 0
  590. end)
  591.  
  592. Option.MouseButton1Up:Connect(function()
  593. Option.BackgroundTransparency = 1
  594. end)
  595.  
  596. Option.MouseLeave:Connect(function()
  597. Option.BackgroundTransparency = 1
  598. end)
  599.  
  600. Option.MouseButton1Click:Connect(function()
  601. Dropdown.Container.Value.Text = OptionName
  602. Callback(OptionName)
  603. end)
  604. end
  605. function DropdownInit:AddToolTip(Name)
  606. if tostring(Name):gsub(" ", "") ~= "" then
  607. Dropdown.MouseEnter:Connect(function()
  608. Screen.ToolTip.Text = Name
  609. Screen.ToolTip.Size = UDim2.new(0,Screen.ToolTip.TextBounds.X + 5,0,Screen.ToolTip.TextBounds.Y + 5)
  610. Screen.ToolTip.Visible = true
  611. end)
  612.  
  613. Dropdown.MouseLeave:Connect(function()
  614. Screen.ToolTip.Visible = false
  615. end)
  616. end
  617. end
  618.  
  619. function DropdownInit:GetOption()
  620. return Dropdown.Container.Value.Text
  621. end
  622. function DropdownInit:SetOption(Name)
  623. for _,Option in pairs(Dropdown.Container.Holder.Container:GetChildren()) do
  624. if Option:IsA("TextButton") and string.find(Option.Name, Name) then
  625. Dropdown.Container.Value.Text = Option.Name
  626. Callback(Name)
  627. end
  628. end
  629. end
  630. function DropdownInit:RemoveOption(Name)
  631. for _,Option in pairs(Dropdown.Container.Holder.Container:GetChildren()) do
  632. if Option:IsA("TextButton") and string.find(Option.Name, Name) then
  633. Option:Destroy()
  634. end
  635. end
  636. Dropdown.Container.Holder.Size = UDim2.new(1,-5,0,Dropdown.Container.Holder.Container.ListLayout.AbsoluteContentSize.Y)
  637. Dropdown.Size = UDim2.new(1,-10,0,Dropdown.Container.Holder.Container.ListLayout.AbsoluteContentSize.Y + Dropdown.Title.TextBounds.Y + 30)
  638. end
  639. function DropdownInit:ClearOptions()
  640. for _, Option in pairs(Dropdown.Container.Holder.Container:GetChildren()) do
  641. if Option:IsA("TextButton") then
  642. Option:Destroy()
  643. end
  644. end
  645. Dropdown.Container.Holder.Size = UDim2.new(1,-5,0,Dropdown.Container.Holder.Container.ListLayout.AbsoluteContentSize.Y)
  646. Dropdown.Size = UDim2.new(1,-10,0,Dropdown.Container.Holder.Container.ListLayout.AbsoluteContentSize.Y + Dropdown.Title.TextBounds.Y + 30)
  647. end
  648. if InitialValue then
  649. DropdownInit:SetOption(InitialValue)
  650. end
  651. return DropdownInit
  652. end
  653. function SectionInit:CreateColorpicker(Name,Callback)
  654. local ColorpickerInit = {}
  655. local Colorpicker = Folder.Colorpicker:Clone()
  656. local Pallete = Folder.Pallete:Clone()
  657.  
  658. Colorpicker.Name = Name .. " CP"
  659. Colorpicker.Parent = Section.Container
  660. Colorpicker.Title.Text = Name
  661. Colorpicker.Title.Font = Enum.Font.Jura
  662. Colorpicker.Size = UDim2.new(1,-10,0,Colorpicker.Title.TextBounds.Y + 5)
  663.  
  664. Pallete.Name = Name .. " P"
  665. Pallete.Parent = Screen
  666.  
  667. local ColorTable = {
  668. Hue = 1,
  669. Saturation = 0,
  670. Value = 0
  671. }
  672. local ColorRender = nil
  673. local HueRender = nil
  674. local ColorpickerRender = nil
  675. local function UpdateColor()
  676. Colorpicker.Color.BackgroundColor3 = Color3.fromHSV(ColorTable.Hue,ColorTable.Saturation,ColorTable.Value)
  677. Pallete.GradientPallete.BackgroundColor3 = Color3.fromHSV(ColorTable.Hue,1,1)
  678. Pallete.Input.InputBox.PlaceholderText = "RGB: " .. math.round(Colorpicker.Color.BackgroundColor3.R* 255) .. "," .. math.round(Colorpicker.Color.BackgroundColor3.G * 255) .. "," .. math.round(Colorpicker.Color.BackgroundColor3.B * 255)
  679. Callback(Colorpicker.Color.BackgroundColor3)
  680. end
  681.  
  682. Colorpicker.MouseButton1Click:Connect(function()
  683. if not Pallete.Visible then
  684. ColorpickerRender = RunService.RenderStepped:Connect(function()
  685. Pallete.Position = UDim2.new(0,Colorpicker.Color.AbsolutePosition.X - 129,0,Colorpicker.Color.AbsolutePosition.Y + 52)
  686. end)
  687. Pallete.Visible = true
  688. else
  689. Pallete.Visible = false
  690. ColorpickerRender:Disconnect()
  691. end
  692. end)
  693.  
  694. Pallete.GradientPallete.InputBegan:Connect(function(Input)
  695. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  696. if ColorRender then
  697. ColorRender:Disconnect()
  698. end
  699. ColorRender = RunService.RenderStepped:Connect(function()
  700. local Mouse = UserInputService:GetMouseLocation()
  701. local ColorX = math.clamp(Mouse.X - Pallete.GradientPallete.AbsolutePosition.X, 0, Pallete.GradientPallete.AbsoluteSize.X) / Pallete.GradientPallete.AbsoluteSize.X
  702. local ColorY = math.clamp((Mouse.Y - 37) - Pallete.GradientPallete.AbsolutePosition.Y, 0, Pallete.GradientPallete.AbsoluteSize.Y) / Pallete.GradientPallete.AbsoluteSize.Y
  703. Pallete.GradientPallete.Dot.Position = UDim2.new(ColorX,0,ColorY,0)
  704. ColorTable.Saturation = ColorX
  705. ColorTable.Value = 1 - ColorY
  706. UpdateColor()
  707. end)
  708. end
  709. end)
  710.  
  711. Pallete.GradientPallete.InputEnded:Connect(function(Input)
  712. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  713. if ColorRender then
  714. ColorRender:Disconnect()
  715. end
  716. end
  717. end)
  718.  
  719. Pallete.ColorSlider.InputBegan:Connect(function(Input)
  720. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  721. if HueRender then
  722. HueRender:Disconnect()
  723. end
  724. HueRender = RunService.RenderStepped:Connect(function()
  725. local Mouse = UserInputService:GetMouseLocation()
  726. local HueX = math.clamp(Mouse.X - Pallete.ColorSlider.AbsolutePosition.X, 0, Pallete.ColorSlider.AbsoluteSize.X) / Pallete.ColorSlider.AbsoluteSize.X
  727. ColorTable.Hue = 1 - HueX
  728. UpdateColor()
  729. end)
  730. end
  731. end)
  732.  
  733. Pallete.ColorSlider.InputEnded:Connect(function(Input)
  734. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  735. if HueRender then
  736. HueRender:Disconnect()
  737. end
  738. end
  739. end)
  740.  
  741. function ColorpickerInit:UpdateColor(Color)
  742. local Hue, Saturation, Value = Color:ToHSV()
  743. Colorpicker.Color.BackgroundColor3 = Color3.fromHSV(Hue,Saturation,Value)
  744. Pallete.GradientPallete.BackgroundColor3 = Color3.fromHSV(Hue,1,1)
  745. Pallete.Input.InputBox.PlaceholderText = "RGB: " .. math.round(Colorpicker.Color.BackgroundColor3.R* 255) .. "," .. math.round(Colorpicker.Color.BackgroundColor3.G * 255) .. "," .. math.round(Colorpicker.Color.BackgroundColor3.B * 255)
  746. ColorTable = {
  747. Hue = Hue,
  748. Saturation = Saturation,
  749. Value = Value
  750. }
  751. Callback(Color)
  752. end
  753.  
  754. Pallete.Input.InputBox.FocusLost:Connect(function(Enter)
  755. if Enter then
  756. local ColorString = string.split(string.gsub(Pallete.Input.InputBox.Text," ", ""), ",")
  757. ColorpickerInit:UpdateColor(Color3.fromRGB(ColorString[1],ColorString[2],ColorString[3]))
  758. Pallete.Input.InputBox.Text = ""
  759. end
  760. end)
  761.  
  762. function ColorpickerInit:AddToolTip(Name)
  763. if tostring(Name):gsub(" ", "") ~= "" then
  764. Colorpicker.MouseEnter:Connect(function()
  765. Screen.ToolTip.Text = Name
  766. Screen.ToolTip.Size = UDim2.new(0,Screen.ToolTip.TextBounds.X + 5,0,Screen.ToolTip.TextBounds.Y + 5)
  767. Screen.ToolTip.Visible = true
  768. end)
  769.  
  770. Colorpicker.MouseLeave:Connect(function()
  771. Screen.ToolTip.Visible = false
  772. end)
  773. end
  774. end
  775.  
  776. return ColorpickerInit
  777. end
  778. return SectionInit
  779. end
  780. return TabInit
  781. end
  782. return WindowInit
  783. end
  784.  
  785. return Library
Tags: skid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement