Advertisement
StenHisDirt

Untitled

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