· last year · Jul 14, 2024, 07:56 PM
1--[[ Pepsi's UI Library
2Better and updated web-based docs are planned in distant future.
3Library v0.36 [
4 CreateWindow: Function (
5 (table | nil) Options [
6 (string | nil) Name = "Window Name"
7 (JSON | nil) DefaultTheme/Theme = "[...]"
8 (boolean | nil) Themeable/DefaultTheme/Theme = true or false | Options [
9 (string | number | nil) Image = "rbxassetid://7483871523" | 7483871523
10 (boolean | nil) Credit = true or false // You're removing my credits? Kinda hurts.
11 (string | table | nil) Info = "Extra info displayed in designer" | Lines ["line 1", "line 2", "line 3", "and so on..."]
12 (string | number | table | nil) Background/Backdrop/Grahpic = "rbxassetid://13337" | 13337 | Options [
13 (string | number | nil) 1/Asset = "rbxassetid://13337" | 13337
14 (number | nil) 2/Transparency = 0.5 | 50 // Both examples will make the backdrop half visible
15 (boolean | number | nil) 3/Visible = true or false | 1 or 0 // 1: true, 0: false
16 ]
17 ]
18 ]
19 ) -> Window [
20 CreateTab: Function (
21 (table | nil) Options [
22 (string | nil) Name = "Tab Name"
23 (string | number | nil) Image = "rbxassetid://133337" | 133337
24 ]
25 ) -> Tab [
26 CreateSection: Function (
27 (table) Options [
28 (string | nil) Name = "Section Name"
29 (string | nil) Side = "Left" or "Right"
30 ]
31 ) -> Section [
32 AddLabel: Function (
33 (table) Options [
34 (string | nil) Text/Value/Name = "Label Text"
35 (string | nil) Flag = "FlagName"
36 (any) UnloadValue = UnloadValue
37 (function | nil) UnloadFunc = Function
38 ]
39 ) -> Label [
40 Options: Table
41 Name: String
42 Type: String
43 Default: String
44 Parent: Section
45 Instance: Instance
46 Set: Function (NewText) -> NewText
47 RawSet: Function (NewText) -> NewText // Same function as Set. For backwards compatibility.
48 Reset: Function -> DefaultText
49 Get: Function -> CurrentText
50 Update: Function -> CurrentText // Same function as Get, exists for compat.
51 ]
52 AddToggle: Function (
53 (table) Options [
54 (string) Name = "Toggle Name"
55 (boolean | nil) Value/Enabled = true or false
56 (function | nil) Callback = Function (NewValue, OldValue)
57 (string | nil) Flag = "FlagName"
58 (table | nil) Location = Table
59 (string | nil) LocationFlag = "LocationFlag"
60 (any) UnloadValue = UnloadValue
61 (function | nil) UnloadFunc = Function
62 (boolean | nil) Locked = true or false
63 (table | boolean | EnumItem | nil) Keybind/Key/KeyBind = Keybind [
64 (string | nil) Flag = "ToggleKeybindFlag"
65 (EnumItem | nil) Value = Enum.KeyCode.F
66 (function | nil) Callback = Function (NewValue, OldValue)
67 (function | nil) Pressed = Function
68 (string | nil) Mode = "Dynamic" or "Hold" or "Toggle"
69 (number | nil) DynamicTime = 0.65
70 (table | nil) Location = Table
71 (string | nil) LocationFlag = "LocationFlag"
72 (table | nil) KeyNames = Table
73 ]
74 (function | nil) Condition = Function (NewValue, LastValue) // Will only allow the toggle state to be changed, if this function returns true
75 (boolean | nil) AllowDuplicateCalls = true or false // Allow the callback to be fired with same value set()
76 ]
77 ) -> ToggleInfo [
78 Options: Table
79 Type: String
80 Name: String
81 Default: Boolean
82 Parent: Section
83 Instance: Instance
84 SetLocked: Function (LockedState) -> LockState
85 Unlock: function
86 Lock: Function
87 Update: Function -> CurrentValue
88 Set: Function (NewValue) -> NewValue
89 RawSet: Function (NewValue, Condition) -> NewValue // Sets the flag without firing the callback
90 Reset: Function -> DefaultText
91 Get: Function -> CurrentValue
92 SetCondition: Function (NewCondition) -> NewCondition
93 ]
94 AddTextbox: Function (
95 (table) Options [
96 (string) Name = "Textbox Name"
97 (string | number) Value = "String" or 1337
98 (function | nil) Callback = Function (NewValue, OldValue)
99 (string | nil) Flag = "FlagName"
100 (table | nil) Location = Table
101 (string | nil) LocationFlag = "LocationFlag"
102 (any) UnloadValue = UnloadValue
103 (function | nil) UnloadFunc = Function
104 (string | nil) Placeholder = "Text to display by default"
105 (string | nil) Type = "number"
106 (number | nil) Min = 0
107 (number | nil) Max = 100
108 (number | nil) Decimals/Precision/Precise = 2
109 (boolean | nil) Hex = true or false
110 (boolean | nil) Binary = true or false
111 (number | nil) Base = 10
112 (boolean | nil) Rich/RichText/RichTextBox = true or false
113 (boolean | nil) Lines/MultiLine = true or false
114 (boolean | nil) Scaled/TextScaled = true or false
115 (EnumItem | nil) Font/TextFont = Enum.Font.Code
116 (function | nil) PreFormat = Function (Value)
117 (function | nil) PostFormat = Function (Value)
118 (table | nil) CustomProperties = Properties [
119 TextTruncate = Enum.TextTruncate.None
120 ]
121 (boolean | nil) AllowDuplicateCalls = true or false // Allow the callback to be fired with same value set()
122 ]
123 ) -> Textbox [
124 Options: Table
125 Name: String
126 Type: String
127 Default: String/Number
128 Parent: Section
129 Instance: Textbox
130 Update: Function -> CurrentValue
131 Set: Function (NewValue) -> NewValue
132 RawSet: Function (NewValue) -> NewValue // Sets the flag without firing the callback
133 Reset: Function -> DefaultText
134 Get: Function -> CurrentValue
135 ]
136 AddSlider: Function (
137 (table) Options [
138 (string) Name = "Slider Name"
139 (number | nil) Value = 0
140 (function | nil) Callback = Function (Value, OldValue)
141 (string | nil) Flag = "FlagName"
142 (table | nil) Location = Table
143 (string | nil) LocationFlag = "LocationFlag"
144 (any) UnloadValue = UnloadValue
145 (function | nil) UnloadFunc = Function
146 (number) Min = 0
147 (number) Max = 100
148 (number | nil) Decimals/Precision/Precise = 2
149 (string | function | nil) Format = "Value %s" | Function (Value, LastValue)
150 (boolean | nil) IllegalInput = true or false // Allow textbox to break min & max limits
151 (boolean | table | nil) Textbox/InputBox/CustomInput = true | Options [
152 (boolean | nil) Hex = true or false
153 (boolean | nil) Binary = true or false
154 (number | nil) Base = 10
155 (function | nil) PreFormat = Function (Value)
156 (function | nil) PostFormat = Function (Value)
157 (boolean | nil) IllegalInput = true or false // Allow textbox to break min & max limits
158 ]
159 (boolean | nil) AllowDuplicateCalls = true or false // Allow the callback to be fired with same value set()
160 ]
161 ) -> Slider [
162 Options: Table
163 Name: String
164 Type: String
165 Default: Number
166 Parent: Section
167 Instance: Instance
168 Update: Function (FromValue) -> CurrentValue
169 Set: Function (NewValue) -> NewValue
170 RawSet: Function (NewValue) -> NewValue // Changes value without firing callback
171 Reset: Function -> DefaultText
172 Get: Function -> CurrentValue
173 SetConstraints: Function (NewMin, NewMax)
174 SetMin: Function (NewMin)
175 SetMax: Function (NewMax)
176 ]
177 AddButton: Function (
178 (table) Options [
179 (string) Name = "Button Name"
180 (function | nil) Callback = Function (NumPresses)
181 (boolean | nil) Locked = true or false
182 (function | nil) Condition = Function (NumPresses) // Will only allow the button to be pressed, if this function returns true
183 ]
184 (table | nil) Options ...
185 ) -> Buttons [
186 Options: Table
187 Name: String
188 Type: String
189 Parent: Section
190 Instance: Instance
191 Update: Function -> ButtonName
192 Press: Function (...)
193 SetLocked: Function (LockedState) -> LockState
194 Unlock: function
195 Lock: Function
196 SetCondition: Function(NewCondition) -> NewCondition
197 RawPress: Function (...) // Does not update press count
198 Get: Function -> Callback, NumPresses
199 SetText: Function (NewText) -> NewText
200 SetCallback: Function (NewCallback) -> NewCallback
201 ]
202 AddKeybind: Function (
203 (table) Options [
204 (string) Name = "Keybind Name"
205 (EnumItem | nil) Value = Enum.KeyCode.F
206 (function | nil) Callback = Function (NewValue, OldValue)
207 (string | nil) Flag = "FlagName"
208 (table | nil) Location = Table
209 (string | nil) LocationFlag = "LocationFlag"
210 (any) UnloadValue = UnloadValue
211 (function | nil) UnloadFunc = Function
212 (function | nil) Pressed = Function (InputObject, GameProcessed)
213 (table | nil) KeyNames = Table
214 (boolean | nil) AllowDuplicateCalls = true or false // Allow the callback to be fired with same value set()
215 ]
216 ) -> Keybind [
217 Options: Table
218 Name: String
219 Type: String
220 Parent: Section
221 Instance: Instance
222 Update: Function
223 Set: Function (NewValue) -> NewValue
224 Reset: Function -> DefaultText
225 Get: Function -> CurrentValue
226 ]
227 AddDropdown: Function (
228 (table) Options [
229 (string) Name = "Dropdown Name"
230 (any) Value = Value
231 (function | nil) Callback = Function (NewValue, LastValue)
232 (string | nil) Flag = "FlagName"
233 (table | nil) Location = Table
234 (string | nil) LocationFlag = "LocationFlag"
235 (any) UnloadValue = UnloadValue
236 (function | nil) UnloadFunc = Function
237 (table | Instance | Enum | function) List = Table | workspace | Enum.Font | Function () -> New List
238 (string | function | table | nil) Filter = "StringToMatch" | Function (ValueToCheck) | Table [
239 (boolean | nil) [0] = InverseBool
240 (any) [1] ... = "StringToMatch" | Enum.Font.Code/ValuesToMatch
241 ]
242 (string | function | table | nil) Method = "GetDescendants" | workspace.GetDescendants | Parameters [
243 (string | function) [1/Method] = "GetFriendsOnline" | Player.GetFriendsOnline
244 (any) [1/2/Args/Arguments] ... = 50
245 ]
246 (string | nil) BlankValue/NoValueString/Nothing = "No Selection"
247 (boolean | function | nil) Sort = true or false | Function
248 (boolean | string | nil) Multi/Multiple/MultiSelect = true or false | "Text to display"
249 (function | nil) ItemAdded/AddedCallback = Function (Item, AllItems)
250 (function | nil) ItemRemoved/RemovedCallback = Function (Item, AllItems)
251 (function | nil) ItemChanged/ChangedCallback = Function (Item, SelectedState, Items)
252 (function | nil) ItemsCleared/ClearedCallback = Function (Items, PreviousItems)
253 (EnumItem/Keycode | nil) ScrollUpButton = Enum.KeyCode.Up // Default is Enum.KeyCode.Up
254 (EnumItem/Keycode | nil) ScrollDownButton = Enum.KeyCode.Down // Default is Enum.KeyCode.Down
255 (number | nil) ScrollButtonRate / ScrollRate = 5 // How fast the scroller goes by pressing the scroll buttons
256 (bool | nil) DisablePrecisionScrolling = true or false // Dissallows use of keys to control pan
257 (boolean | nil) AllowDuplicateCalls = true or false // Allow the callback to be fired with same value set()
258 ]
259 ) -> Dropdown [
260 Options: Table
261 Name: String
262 Type: String
263 Default: Value
264 Parent: Section
265 Instance: Instance
266 Update: Function
267 Set: Function (NewValue) -> NewValue
268 RawSet: Function (NewValue) -> NewValue // Sets value without firing callback
269 Reset: Function -> DefaultValue
270 Get: Function -> CurrentValue
271 UpdateList: Function (
272 (table | Instance | Enum | function) List = Table | workspace | Enum.Font | Function () -> New List
273 (boolean | nil) ValidateValues = true or false | nil // When set to true, will call Validate() on it
274 ) -> NewList
275 Validate: Function (
276 (any | nil) InvalidValue = "Optional value to be set, if the list's current value is no longer in list"
277 ) -> IsValidBool
278 ]
279 AddSearchBox: Function (
280 (table) Options [
281 (string) Name = "SearchBox Name"
282 (any) Value = Value
283 (function | nil) Callback = Function (NewValue, LastValue)
284 (string | nil) Flag = "FlagName"
285 (table | nil) Location = Table
286 (string | nil) LocationFlag = "LocationFlag"
287 (any) UnloadValue = UnloadValue
288 (function | nil) UnloadFunc = Function
289 (table | Instance | Enum | function) List = Table | workspace | Enum.Font | Function () -> New List
290 (string | function | table | nil) Filter = "StringToMatch" | Function (ValueToCheck) | Table [
291 (boolean | nil) [0] = InverseBool
292 (string | any | nil) [1] ... = "StringToMatch" | Enum.Font.Code
293 ]
294 (string | function | table | nil) Method = "GetDescendants" | workspace.GetDescendants | Parameters [
295 (string | function) [1/Method] = "GetFriendsOnline" | Player.GetFriendsOnline
296 (any) [1/2/Args/Arguments] ... = 50
297 ]
298 (boolean | function | nil) Sort = true or false | Function
299 (string | nil) BlankValue/NoValueString/Nothing = "No Selection"
300 (boolean | string | nil) Multi/Multiple/MultiSelect = true or false | "Text to display"
301 (function | nil) ItemAdded/AddedCallback = Function (Item, AllItems)
302 (function | nil) ItemRemoved/RemovedCallback = Function (Item, AllItems)
303 (function | nil) ItemChanged/ChangedCallback = Function (Item, SelectedState, Items)
304 (function | nil) ItemsCleared/ClearedCallback = Function (Items, PreviousItems)
305 (EnumItem/Keycode | nil) ScrollUpButton = Enum.KeyCode.Up // Default is Enum.KeyCode.Up
306 (EnumItem/Keycode | nil) ScrollDownButton = Enum.KeyCode.Down // Default is Enum.KeyCode.Down
307 (number | nil) ScrollButtonRate / ScrollRate = 5 // How fast the scroller goes by pressing the scroll buttons
308 (bool | nil) DisablePrecisionScrolling = true or false // Dissallows use of keys to control pan
309 (boolean | nil) RegEx = true or false // Enables use of %d and %w, etc (False by default)
310 (boolean | nil) AllowDuplicateCalls = true or false // Allow the callback to be fired with same value set()
311 ]
312 ) -> SearchBox [
313 Options: Table
314 Name: String
315 Type: String
316 Default: Value
317 Parent: Section
318 Instance: Instance
319 Update: Function
320 Set: Function (NewValue) -> NewValue
321 RawSet: Function (NewValue) -> NewValue // Sets value without firing callback
322 Reset: Function -> DefaultValue
323 Get: Function -> CurrentValue
324 UpdateList: Function (
325 (table | Instance | Enum | function) List = Table | workspace | Enum.Font | Function () -> New List
326 (boolean | nil) ValidateValues = true or false | nil // When set to true, will call Validate() on it
327 ) -> NewList
328 Validate: Function (
329 (any | nil) InvalidValue = "Optional value to be set, if the list's current value is no longer in list"
330 ) -> IsValidBool
331 ]
332 AddColorpicker: Function (
333 (table) Options [
334 (string) Name = "Colorpicker Name"
335 (string | Color3 | nil) Value = "rainbow" or "random" | Color3.new()
336 (function | nil) Callback = Function (NewValue, LastValue)
337 (string | nil) Flag = "FlagName"
338 (table | nil) Location = Table
339 (string | nil) LocationFlag = "LocationFlag"
340 (any) UnloadValue = UnloadValue
341 (function | nil) UnloadFunc = Function
342 (boolean | nil) Rainbow = true or false
343 (boolean | nil) Random = true or false
344 (boolean | nil) AllowDuplicateCalls = true or false // Allow the callback to be fired with same value set()
345 ]
346 ) -> Colorpicker [
347 Options: Table
348 Name: String
349 Type: String
350 Default: Color3
351 Parent: Section
352 Instance: Instance
353 Update: Function
354 Set: Function (NewValue) -> NewValue
355 RawSet: Function (NewValue) -> NewValue // Sets value without firing callback
356 Reset: Function -> DefaultColor
357 Get: Function -> CurrentValue
358 SetRainbow: Function (
359 (boolean | nil) RainbowMode = true or false
360 )
361 ]
362 AddPersistence: Function (
363 (table) Options [
364 (string) Name = "Persistence Name"
365 (string | nil) Value = "FileName"
366 (function | nil) Callback = Function (NewValue, LastValue)
367 (string | nil) Flag = "FlagName"
368 (table | nil) Location = Table
369 (string | nil) LocationFlag = "LocationFlag"
370 (any) UnloadValue = UnloadValue
371 (function | nil) UnloadFunc = Function
372 (string | nil) Workspace = "FolderName"
373 (boolean | string | number | table | nil) Persistive/Flags = true | "all" | 1 (Window) or 2 (Tab) or 3 (Section) | FlagNames [...]
374 (string | nil) Suffix = "Mods"
375 (function | nil) LoadCallback = Function (FilePath, FileName) // 'PreLoad'
376 (function | nil) SaveCallback = Function (FilePath, FileName)
377 (function | nil) PostLoadCallback = Function (FilePath, FileName)
378 (function | nil) PostSaveCallback = Function (FilePath, FileName)
379 (EnumItem/Keycode | nil) ScrollUpButton = Enum.KeyCode.Up // Default is Enum.KeyCode.Up
380 (EnumItem/Keycode | nil) ScrollDownButton = Enum.KeyCode.Down // Default is Enum.KeyCode.Down
381 (number | nil) ScrollButtonRate / ScrollRate = 5 // How fast the scroller goes by pressing the scroll buttons
382 (bool | nil) DisablePrecisionScrolling = true or false // Dissallows use of keys to control pan
383 (boolean | nil) AllowDuplicateCalls = true or false // Allow the callback to be fired with same value set()
384 ]
385 ) -> Persistence [
386 Options: Table
387 Name: String
388 Type: String
389 Default: Value
390 Parent: Section
391 Instance: Instance
392 Update: Function
393 Set: Function (NewValue) -> NewValue
394 RawSet: Function (NewValue) -> NewValue // Sets value without firing callback
395 Reset: Function -> DefaultFile
396 Get: Function -> CurrentValue
397 SaveFile: Function (FileName) // Mimics the Save Button with optional file input
398 LoadFile: Function (FileName) // Mimics the Load Button with optional file input
399 LoadJSON: Function (JSON) // Mimics the Load Button with specific json
400 LoadFileRaw: Function (FileName) // Mimics the Load Button with optional file input using Obj:RawSet
401 LoadJSONRaw: Function (JSON) // Mimics the Load Button with specific json using Obj:RawSet
402 GetJSON: Function (Func) // Gets the json, and passes it as the first argument of Func. Set to true to use setclipboard
403 ]
404 ]
405 Flags: Table
406 ]
407 CreateDesigner: Function (
408 (table) Options [
409 (string | number | table | nil) Background/Backdrop/Grahpic = "rbxassetid://13337" | 13337 | Options [
410 (string | number | nil) 1/Asset = "rbxassetid://13337" | 13337
411 (number | nil) 2/Transparency = 0.5 | 50 // Both examples will make the backdrop half visible
412 (boolean | number | nil) 3/Visible = true or false | 1 or 0 // 1: true, 0: false
413 ]
414 (string | number | nil) Image = "rbxassetid://7483871523" | 7483871523
415 (string | table | nil) Info = "Extra info displayed in designer" | Lines ["line 1", "line 2", "line 3", "and so on..."]
416 (boolean | nil) Credit = true
417 ]
418 ) -> Designer [
419 Options: Table
420 Parent: Window
421 Name: String
422 Type: String
423 Instance: Instance,
424 SetBackground: Function (
425 (string | boolean | number | nil) AssetString = "rbxassetid://7483871523" | true or false (as Visible arg) | 7483871523 or transparency (0-100 or 0-1) | nil (Toggle visibility)
426 (number | boolean | nil) Transparency = 0.7 or 70 | true or false (as Visible arg)
427 (number | boolean | nil) Visible = true/1 or false/0 | nil (Dont change)
428 )
429 ]
430 MoveTabSlider: Function (
431 (Instance) tabObject = tabVar
432 )
433 GoHome: Function
434 Flags: Table
435 ]
436 Designer: Designer
437 LP: LocalPlayer
438 Players: game.Players
439 Mouse: LP:GetMouse()
440 Unload: Function
441 ResetAll: Function // Resets all elements to their default value
442 SaveFile: Function (FileName) // Only if designer is present; this would save all non-deisgner elements
443 LoadFile: Function (FileName)
444 LoadJSON: Function (JSON)
445 LoadFileRaw: Function (FileName)
446 LoadJSONRaw: Function (JSON)
447 GetJSON: Function (Func)
448 signals: Table // All :connection()'s go in that table, and are disconnected upon unloading the gui. Feel free to add yours here, too
449 (function | nil) UnloadCallback = Function
450 (EnumItem/Keycode | nil) scrollupbutton = Enum.KeyCode.Up // Default is Enum.KeyCode.Up
451 (EnumItem/Keycode | nil) scrolldownbutton = Enum.KeyCode.Down // Default is Enum.KeyCode.Down
452 Subs: Shared Functions [
453 updatecolors: Function // Re-Applys all colors from designer
454 Wait: Function (Time) // Only waits & returns true if the library has not been unloaded
455 removeSpaces: Function (String)
456 Color3ToHex: Function (Color3)
457 Color3FromHex: Function (String/Hex)
458 textToSize: Function (String)
459 Instance_new: Function (Class, Parent) // Automatically protects instances with syn.protect_gui, and adds the instance to library.objects (all objects destroyed when unloading)
460 ]
461]
462]]
463local library = {
464 Version = "0.36",
465 WorkspaceName = "Pepsi Lib",
466 flags = {},
467 signals = {},
468 objects = {},
469 elements = {},
470 globals = {},
471 subs = {},
472 colored = {},
473 configuration = {
474 hideKeybind = Enum.KeyCode.RightShift,
475 smoothDragging = false,
476 easingStyle = Enum.EasingStyle.Quart,
477 easingDirection = Enum.EasingDirection.Out
478 },
479 colors = {
480 main = Color3.fromRGB(117, 25, 255),
481 background = Color3.fromRGB(18, 17, 17),
482 outerBorder = Color3.fromRGB(13, 12, 12),
483 innerBorder = Color3.fromRGB(139, 31, 255),
484 topGradient = Color3.fromRGB(35, 35, 35),
485 bottomGradient = Color3.fromRGB(29, 29, 29),
486 sectionBackground = Color3.fromRGB(15, 15, 15),
487 section = Color3.fromRGB(255, 255, 255),
488 otherElementText = Color3.fromRGB(190, 190, 190),
489 elementText = Color3.fromRGB(117, 25, 255),
490 elementBorder = Color3.fromRGB(117, 25, 255),
491 selectedOption = Color3.fromRGB(55, 55, 55),
492 unselectedOption = Color3.fromRGB(40, 40, 40),
493 hoveredOptionTop = Color3.fromRGB(65, 65, 65),
494 unhoveredOptionTop = Color3.fromRGB(50, 50, 50),
495 hoveredOptionBottom = Color3.fromRGB(45, 45, 45),
496 unhoveredOptionBottom = Color3.fromRGB(35, 35, 35),
497 tabText = Color3.fromRGB(255, 255, 255)
498 },
499 gui_parent = (function()
500 local x, c = pcall(function()
501 return game:GetService("CoreGui")
502 end)
503 if x and c then
504 return c
505 end
506 x, c = pcall(function()
507 return (game:IsLoaded() or (game.Loaded:Wait() or 1)) and game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
508 end)
509 if x and c then
510 return c
511 end
512 x, c = pcall(function()
513 return game:GetService("StarterGui")
514 end)
515 if x and c then
516 return c
517 end
518 return error("Seriously bad engine. Can't find a place to store the GUI. Robust code can't help this much incompetence.")
519 end)(),
520 colorpicker = false,
521 colorpickerconflicts = {},
522 rainbowflags = {},
523 rainbows = 0,
524 rainbowsg = 0
525}
526library.Subs = library.subs
527local library_flags = library.flags
528library.Flags = library_flags
529local destroyrainbows, destroyrainbowsg = nil
530function darkenColor(clr, intensity)
531 if not intensity or (intensity == 1) then
532 return clr
533 end
534 if clr and ((typeof(clr) == "Color3") or (type(clr) == "table")) then
535 return Color3.new(clr.R / intensity, clr.G / intensity, clr.B / intensity)
536 end
537end
538library.subs.darkenColor = darkenColor
539local __runscript = true
540local function wait_check(...)
541 if __runscript then
542 return wait(...)
543 else
544 wait()
545 return false
546 end
547end
548library.subs.Wait, library.subs.wait, library.Wait = wait_check, wait_check, wait_check
549function library.IsGuiValid()
550 return __runscript
551end
552local lasthidebing = 0
553local temp = game:FindService("MarketplaceService") or game:GetService("MarketplaceService")
554local Marketplace = (temp and (cloneref and cloneref(temp))) or temp
555local resolvevararg, temp = nil
556do
557 local lwr = string.lower
558 function library.defaultSort(a, b)
559 return lwr(tostring(b)) > lwr(tostring(a))
560 end
561end
562do
563 local varargresolve = {
564 Window = {"Name", "Theme"},
565 Tab = {"Name", "Image"},
566 Section = {"Name", "Side"},
567 Label = {"Text", "Flag", "UnloadValue", "UnloadFunc"},
568 Toggle = {"Name", "Value", "Callback", "Flag", "Location", "LocationFlag", "UnloadValue", "UnloadFunc", "Locked", "Keybind", "Condition", "AllowDuplicateCalls"},
569 Textbox = {"Name", "Value", "Callback", "Flag", "Location", "LocationFlag", "UnloadValue", "UnloadFunc", "Placeholder", "Type", "Min", "Max", "Decimals", "Hex", "Binary", "Base", "RichTextBox", "MultiLine", "TextScaled", "TextFont", "PreFormat", "PostFormat", "CustomProperties", "AllowDuplicateCalls"},
570 Slider = {"Name", "Value", "Callback", "Flag", "Location", "LocationFlag", "UnloadValue", "UnloadFunc", "Min", "Max", "Decimals", "Format", "IllegalInput", "Textbox", "AllowDuplicateCalls"},
571 Button = {"Name", "Callback", "Locked", "Condition"},
572 Keybind = {"Name", "Value", "Callback", "Flag", "Location", "LocationFlag", "UnloadValue", "UnloadFunc", "Pressed", "KeyNames", "AllowDuplicateCalls"},
573 Dropdown = {"Name", "Value", "Callback", "Flag", "Location", "LocationFlag", "UnloadValue", "UnloadFunc", "List", "Filter", "Method", "Nothing", "Sort", "MultiSelect", "ItemAdded", "ItemRemoved", "ItemChanged", "ItemsCleared", "ScrollUpButton", "ScrollDownButton", "ScrollButtonRate", "DisablePrecisionScrolling", "AllowDuplicateCalls"},
574 SearchBox = {"Name", "Value", "Callback", "Flag", "Location", "LocationFlag", "UnloadValue", "UnloadFunc", "List", "Filter", "Method", "Nothing", "Sort", "MultiSelect", "ItemAdded", "ItemRemoved", "ItemChanged", "ItemsCleared", "ScrollUpButton", "ScrollDownButton", "ScrollButtonRate", "DisablePrecisionScrolling", "RegEx", "AllowDuplicateCalls"},
575 Colorpicker = {"Name", "Value", "Callback", "Flag", "Location", "LocationFlag", "UnloadValue", "UnloadFunc", "Rainbow", "Random", "AllowDuplicateCalls"},
576 Persistence = {"Name", "Value", "Callback", "Flag", "Location", "LocationFlag", "UnloadValue", "UnloadFunc", "Workspace", "Persistive", "Suffix", "LoadCallback", "SaveCallback", "PostLoadCallback", "PostSaveCallback", "ScrollUpButton", "ScrollDownButton", "ScrollButtonRate", "DisablePrecisionScrolling", "AllowDuplicateCalls"},
577 Designer = {"Backdrop", "Image", "Info", "Credit"}
578 }
579 function resolvevararg(objtype, ...)
580 local data = varargresolve[objtype]
581 local t = {}
582 if data then
583 for index, value in next, {...} do
584 t[data[index]] = value
585 end
586 end
587 return t
588 end
589end
590local resolvercache = {}
591library.resolvercache = resolvercache
592local function resolveid(image, flag)
593 if image then
594 if type(image) == "string" then
595 if (#image > 14 and string.sub(image, 1, 13) == "rbxassetid://") or (#image > 12 and string.sub(image, 1, 11) == "rbxasset://") or (#image > 12 and string.sub(image, 1, 11) ~= "rbxthumb://") then
596 if flag then
597 local thing = library.elements[flag] or library.designerelements[flag]
598 if thing and thing.Set then
599 task.spawn(thing.Set, thing, image)
600 end
601 end
602 return image
603 end
604 end
605 local orig = image
606 if resolvercache[orig] then
607 if flag then
608 local thing = library.elements[flag] or library.designerelements[flag]
609 if thing and thing.Set then
610 task.spawn(thing.Set, thing, resolvercache[orig])
611 end
612 end
613 return resolvercache[orig]
614 end
615 image = tonumber(image) or image
616 local succezz = pcall(function()
617 local typ = type(image)
618 if typ == "string" then
619 if getsynasset then
620 if #image > 11 and (string.sub(image, 1, 11) == "synasset://") then
621 return getsynasset(string.sub(image, 12))
622 elseif (#image > 14) and (string.sub(image, 1, 14) == "synasseturl://") then
623 local x, e = pcall(function()
624 local codename, fixes = string.gsub(image, ".", function(c)
625 if c:lower() == c:upper() and not tonumber(c) then
626 return ""
627 end
628 end)
629 codename = string.sub(codename, 1, 24) .. tostring(fixes)
630 local fold = isfolder("./Pepsi Lib")
631 if fold then
632 else
633 makefolder("./Pepsi Lib")
634 end
635 fold = isfolder("./Pepsi Lib/Themes")
636 if fold then
637 else
638 makefolder("./Pepsi Lib/Themes")
639 end
640 fold = isfolder("./Pepsi Lib/Themes/SynapseAssetsCache")
641 if fold then
642 else
643 makefolder("./Pepsi Lib Themes/SynapseAssetsCache")
644 end
645 if not fold or not isfile("./Pepsi Lib/Themes/SynapseAssetsCache/" .. codename .. ".dat") then
646 local res = game:HttpGet(string.sub(image, 15))
647 if res ~= nil then
648 writefile("./Pepsi Lib/Themes/SynapseAssetsCache/" .. codename .. ".dat", res)
649 end
650 end
651 return getsynasset(readfile("./Pepsi Lib/Themes/SynapseAssetsCache/" .. codename .. ".dat"))
652 end)
653 if x and e ~= nil then
654 return e
655 end
656 end
657 end
658 if (#image < 11) or ((string.sub(image, 1, 13) ~= "rbxassetid://") and (string.sub(image, 1, 11) ~= "rbxasset://") and string.sub(image, 1, 11) ~= "rbxthumb://") then
659 image = tonumber(image:gsub("%D", ""), 10) or image
660 typ = type(image)
661 end
662 end
663 if (typ == "number") and (image > 0) then
664 pcall(function()
665 local nfo = Marketplace and Marketplace:GetProductInfo(image)
666 image = tostring(image)
667 if nfo and nfo.AssetTypeId == 1 then
668 image = "rbxassetid://" .. image
669 elseif nfo.AssetTypeId == 13 then
670 local decal = game:GetObjects("rbxassetid://" .. image)[1]
671 image = "rbxassetid://" .. ((decal and decal.Texture) or "0"):match("%d+$")
672 decal = (decal and decal:Destroy() and nil) or nil
673 end
674 end)
675 else
676 image = nil
677 end
678 end)
679 if succezz and image then
680 if orig then
681 resolvercache[orig] = image
682 end
683 resolvercache[image] = image
684 if flag then
685 local thing = library.elements[flag] or library.designerelements[flag]
686 if thing and thing.Set then
687 task.spawn(thing.Set, thing, image)
688 end
689 end
690 end
691 end
692 return image
693end
694library.subs.ResolveID = resolveid
695library.resolvercache = resolvercache
696local colored, colors = library.colored, library.colors
697local tweenService = game:GetService("TweenService")
698local updatecolors, MainScreenGui = nil
699do
700 local MayGC = 0
701 spawn(function()
702 local IsDescendantOf = game.IsDescendantOf
703 local RemoveTable = table.remove
704 while wait_check() do
705 while shared.NO_LIB_GC do
706 wait(20)
707 if wait_check() then
708 else
709 return
710 end
711 end
712 wait(10)
713 local Breathe = 30
714 for DataIndex = #colored, 1, -1 do
715 if MayGC > 0 then
716 break
717 end
718 Breathe -= 1
719 if Breathe <= 0 then
720 Breathe = 30
721 if wait_check() then
722 if MayGC > 0 then
723 break
724 end
725 else
726 return
727 end
728 end
729 if MayGC > 0 then
730 break
731 end
732 local data = colored[DataIndex]
733 data = data and data[1]
734 if data and (typeof(data) == "Instance") and IsDescendantOf(data, MainScreenGui) then
735 elseif MayGC <= 0 then
736 RemoveTable(colored, DataIndex)
737 else
738 break
739 end
740 end
741 local sigs = library.signals
742 local len = sigs and #sigs
743 if len then
744 local Dyn = math.round(len / 10)
745 Dyn = ((Dyn < 1) and 1) or Dyn
746 for DataIndex = len, 1, -1 do
747 Breathe -= 1
748 if Breathe <= 0 then
749 Breathe = Dyn
750 if wait_check() then
751 else
752 return
753 end
754 end
755 local data = sigs[DataIndex]
756 if data and (typeof(data) == "RBXScriptConnection") and data.Connected then
757 else
758 RemoveTable(sigs, DataIndex)
759 end
760 end
761 end
762 end
763 end)
764 local function colortwee(data, tweenit)
765 local cclr = colors[data[3]]
766 local darkness = data[4]
767 tweenService:Create(data[1], TweenInfo.new(tweenit, library.configuration.easingStyle, library.configuration.easingDirection), {
768 [data[2]] = (darkness and darkness ~= 1 and darkenColor(cclr, darkness)) or cclr
769 }):Play()
770 end
771 local function colordarktwee(data)
772 local cclr = colors[data[3]]
773 local darkness = data[4]
774 data[1][data[2]] = (darkness and darkness ~= 1 and darkenColor(cclr, darkness)) or cclr
775 end
776 function updatecolors(tweenit)
777 MayGC += 1
778 if library.objects and (#library.objects > 0 or next(library.objects)) then
779 for _, data in next, colored do
780 local x, e
781 if tweenit then
782 x, e = pcall(colortwee, data, tweenit)
783 end
784 if x then
785 else
786 local x, e = pcall(colordarktwee, data)
787 if e and not x then
788 warn(debug.traceback(e))
789 end
790 end
791 end
792 pcall(function()
793 if library.Backdrop then
794 library.Backdrop.Visible = library_flags["__Designer.Background.UseBackgroundImage"] and true
795 library.Backdrop.Image = resolveid(library_flags["__Designer.Background.ImageAssetID"], "__Designer.Background.ImageAssetID") or ""
796 library.Backdrop.ImageColor3 = library_flags["__Designer.Background.ImageColor"] or Color3.new(1, 1, 1)
797 library.Backdrop.ImageTransparency = (library_flags["__Designer.Background.ImageTransparency"] or 95) / 100
798 end
799 end)
800 end
801 MayGC -= 1
802 end
803end
804local function updatecolorsnotween()
805 updatecolors()
806end
807library.subs.updatecolors = updatecolors
808library.colors = setmetatable({}, {
809 __index = colors,
810 __newindex = function(_, k, v)
811 if colors[k] ~= v then
812 colors[k] = v
813 spawn(updatecolorsnotween)
814 end
815 end
816})
817local elements = library.elements
818shared.libraries = shared.libraries or {}
819local colorpickerconflicts = library.colorpickerconflicts
820local keyHandler = {
821 notAllowedKeys = {
822 [Enum.KeyCode.Return] = true,
823 [Enum.KeyCode.Space] = true,
824 [Enum.KeyCode.Tab] = true,
825 [Enum.KeyCode.Unknown] = true,
826 [Enum.KeyCode.Backspace] = true
827 },
828 notAllowedMouseInputs = {
829 [Enum.UserInputType.MouseMovement] = true,
830 [Enum.UserInputType.MouseWheel] = true,
831 [Enum.UserInputType.MouseButton1] = true,
832 [Enum.UserInputType.MouseButton2] = true,
833 [Enum.UserInputType.MouseButton3] = true
834 },
835 allowedKeys = {
836 [Enum.KeyCode.LeftShift] = "LShift",
837 [Enum.KeyCode.RightShift] = "RShift",
838 [Enum.KeyCode.LeftControl] = "LCtrl",
839 [Enum.KeyCode.RightControl] = "RCtrl",
840 [Enum.KeyCode.LeftAlt] = "LAlt",
841 [Enum.KeyCode.RightAlt] = "RAlt",
842 [Enum.KeyCode.CapsLock] = "CAPS",
843 [Enum.KeyCode.One] = "1",
844 [Enum.KeyCode.Two] = "2",
845 [Enum.KeyCode.Three] = "3",
846 [Enum.KeyCode.Four] = "4",
847 [Enum.KeyCode.Five] = "5",
848 [Enum.KeyCode.Six] = "6",
849 [Enum.KeyCode.Seven] = "7",
850 [Enum.KeyCode.Eight] = "8",
851 [Enum.KeyCode.Nine] = "9",
852 [Enum.KeyCode.Zero] = "0",
853 [Enum.KeyCode.KeypadOne] = "Num-1",
854 [Enum.KeyCode.KeypadTwo] = "Num-2",
855 [Enum.KeyCode.KeypadThree] = "Num-3",
856 [Enum.KeyCode.KeypadFour] = "Num-4",
857 [Enum.KeyCode.KeypadFive] = "Num-5",
858 [Enum.KeyCode.KeypadSix] = "Num-6",
859 [Enum.KeyCode.KeypadSeven] = "Num-7",
860 [Enum.KeyCode.KeypadEight] = "Num-8",
861 [Enum.KeyCode.KeypadNine] = "Num-9",
862 [Enum.KeyCode.KeypadZero] = "Num-0",
863 [Enum.KeyCode.Minus] = "-",
864 [Enum.KeyCode.Equals] = "=",
865 [Enum.KeyCode.Tilde] = "~",
866 [Enum.KeyCode.LeftBracket] = "[",
867 [Enum.KeyCode.RightBracket] = "]",
868 [Enum.KeyCode.RightParenthesis] = ")",
869 [Enum.KeyCode.LeftParenthesis] = "(",
870 [Enum.KeyCode.Semicolon] = ";",
871 [Enum.KeyCode.Quote] = "'",
872 [Enum.KeyCode.BackSlash] = "\\",
873 [Enum.KeyCode.Comma] = ",",
874 [Enum.KeyCode.Period] = ".",
875 [Enum.KeyCode.Slash] = "/",
876 [Enum.KeyCode.Asterisk] = "*",
877 [Enum.KeyCode.Plus] = "+",
878 [Enum.KeyCode.Period] = ".",
879 [Enum.KeyCode.Backquote] = "`"
880 }
881}
882local SeverAllConnections = nil
883function SeverAllConnections(t, cache)
884 cache = cache or {}
885 for k, v in next, t do
886 t[k] = nil
887 if v ~= nil then
888 if cache[v] then
889 continue
890 end
891 local te = v and typeof(v)
892 if te then
893 if te == "RBXScriptConnection" then
894 v:Disconnect()
895 elseif te == "Instance" then
896 v:Destroy()
897 elseif te == "table" then
898 cache[v] = true
899 SeverAllConnections(v, cache)
900 end
901 end
902 end
903 end
904end
905library.Subs.SeverAllConnections = SeverAllConnections
906local function hardunload(library)
907 if library.UnloadCallback and (type(library.UnloadCallback) == "function") then
908 local x, e = pcall(library.UnloadCallback)
909 if not x and e then
910 task.spawn(error, e, 2)
911 end
912 end
913 for cflag, data in next, elements do
914 if data.Type ~= "Persistence" then
915 if data.Set and data.Options.UnloadValue ~= nil then
916 data.Set(data.Options.UnloadValue)
917 end
918 if data.Options.UnloadFunc then
919 local y, u = pcall(data.Options.UnloadFunc)
920 if not y and u then
921 warn(debug.traceback("Error unloading '" .. tostring(cflag) .. "'\n" .. u))
922 end
923 end
924 end
925 end
926 local hardcache = {}
927 SeverAllConnections(library.signals, hardcache)
928 SeverAllConnections(library.objects, hardcache)
929 hardcache = (table.clear(hardcache) and nil) or nil
930 library.signals = nil
931 library.objects = nil
932end
933library.Subs.UnloadArg = hardunload
934local function unloadall()
935 if shared.libraries then
936 local b = 50
937 while #shared.libraries > 0 do
938 b = b - 1
939 if b < 0 then
940 b = 50
941 wait(warn("Looped 50 times while unloading....?"))
942 end
943 local v = shared.libraries[1]
944 if v and v.unload and (type(v.unload) == "function") then
945 if not pcall(v.unload) then
946 pcall(hardunload, v)
947 for k in next, v do
948 v[k] = nil
949 end
950 end
951 if shared.libraries then
952 pcall(function()
953 table.remove(shared.libraries, 1)
954 end)
955 else
956 return pcall(hardunload, library)
957 end
958 end
959 end
960 end
961 shared.libraries = nil
962end
963shared.unloadall = unloadall
964library.unloadall = unloadall
965shared.libraries[1 + #shared.libraries] = library
966function library.unload()
967 __runscript = nil
968 hardunload(library)
969 if shared.libraries then
970 for k, v in next, shared.libraries or {} do
971 if v == library then
972 for k in next, table.remove(shared.libraries or {}, k) do
973 v[k] = nil
974 end
975 break
976 end
977 end
978 if shared.libraries and (#shared.libraries == 0) then
979 shared.libraries = nil
980 end
981 end
982 warn("Unloaded")
983end
984library.Unload = library.unload
985local Instance_new = (syn and syn.protect_gui and function(...)
986 local x = {Instance.new(...)}
987 if x[1] then
988 library.objects[1 + #library.objects] = x[1]
989 pcall(syn.protect_gui, x[1])
990 end
991 return unpack(x)
992end) or function(...)
993 local x = {Instance.new(...)}
994 if x[1] then
995 library.objects[1 + #library.objects] = x[1]
996 end
997 return unpack(x)
998end
999library.subs.Instance_new = Instance_new
1000local playersservice = game:GetService("Players")
1001local function getresolver(listt, filter, method, _)
1002 local huo, args = type(filter), {}
1003 local hou = typeof(listt)
1004 return ((hou == "function") and function(...)
1005 return listt(...)
1006 end) or ((hou == "table") and function()
1007 return listt
1008 end) or function()
1009 local hardtype = nil
1010 local g = listt
1011 for _ = 1, 5 do
1012 hardtype = typeof(g)
1013 if hardtype == "function" then
1014 local x, e = pcall(listt)
1015 if x and e then
1016 g = e
1017 end
1018 hardtype = typeof(g)
1019 end
1020 if hardtype == "Instance" then
1021 local lastg = g
1022 if method == nil and listt == playersservice then
1023 g = listt:GetPlayers()
1024 end
1025 if method then
1026 local metype = type(method)
1027 if metype == "table" then
1028 method = method.Method or method[1]
1029 args = method.Args or method.Arguments or unpack(method, (method.Method ~= nil and 1) or 2)
1030 metype = type(method)
1031 end
1032 local y, u = nil, nil
1033 if metype == "function" then
1034 y, u = pcall(method, listt, unpack(args))
1035 elseif metype == "string" then
1036 local y, u = pcall(function()
1037 return listt[method](listt, unpack(args))
1038 end)
1039 else
1040 warn("Idk how to handle method type of", metype, debug.traceback(""))
1041 end
1042 if u then
1043 if y then
1044 g = u
1045 else
1046 warn("Error trying method", method, "on", listt, debug.traceback(u))
1047 end
1048 end
1049 end
1050 if g == lastg then
1051 g = listt:GetChildren()
1052 end
1053 end
1054 if hardtype == "Enum" then
1055 g = listt:GetEnumItems()
1056 end
1057 hardtype = typeof(g)
1058 if hardtype == "table" then
1059 break
1060 end
1061 end
1062 hardtype = typeof(g)
1063 if hardtype ~= "table" then
1064 warn("Could not resolve " .. hou .. " type to a list.")
1065 return {}
1066 end
1067 if filter then
1068 if huo == "function" then
1069 local accept = {}
1070 for _, v in next, g do
1071 local x, e = pcall(filter, v)
1072 if x and e then
1073 accept[1 + #accept] = (e == true and v) or e
1074 end
1075 end
1076 g = accept
1077 elseif huo == "string" then
1078 local accept = {}
1079 for _, v in next, g do
1080 if tostring(v):lower():find(huo) then
1081 accept[1 + #accept] = v
1082 end
1083 end
1084 g = accept
1085 elseif huo == "table" then
1086 local accept = {}
1087 if type(filter[1]) == "string" then
1088 for _, v in next, g do
1089 if tostring(v):lower():find(huo) then
1090 accept[1 + #accept] = v
1091 elseif filter[0] then
1092 accept[1 + #accept] = v
1093 end
1094 end
1095 else
1096 for _, v in next, g do
1097 if not table.find(filter, v) and not table.find(filter, tostring(v)) then
1098 accept[1 + #accept] = v
1099 elseif not filter[0] then
1100 accept[1 + #accept] = v
1101 end
1102 end
1103 end
1104 g = accept
1105 end
1106 end
1107 return g
1108 end
1109end
1110library.subs.GetResolver = getresolver
1111local function resetall()
1112 destroyrainbowsg = true
1113 pcall(function()
1114 for k, v in next, elements do
1115 if v and k and v.Set and (v.Default ~= nil) and (library_flags[k] ~= v.Default) and (string.sub(k, 1, 11) ~= "__Designer.") then
1116 v:Set(v.Default)
1117 end
1118 end
1119 end)
1120end
1121library.ResetAll = resetall
1122local textService = game:GetService("TextService")
1123local userInputService = game:GetService("UserInputService")
1124local runService = game:GetService("RunService")
1125local LP = playersservice.LocalPlayer
1126library.LP = LP
1127library.Players = playersservice
1128library.UserInputService = userInputService
1129library.RunService = runService
1130local mouse = LP and LP:GetMouse()
1131if not mouse and PluginManager and runService:IsStudio() then
1132 shared.library_plugin = shared.library_plugin or print("Creating Studio Test-Plugin...") or PluginManager():CreatePlugin()
1133 mouse = shared.library_plugin:GetMouse()
1134 library.plugin = shared.library_plugin
1135end
1136library.Mouse = mouse
1137local textToSize = nil
1138do
1139 local textService = game:GetService("TextService")
1140 local bigv2 = Vector2.one * math.huge
1141 function textToSize(object)
1142 return textService:GetTextSize(object.Text, object.TextSize, object.Font, bigv2)
1143 end
1144end
1145library.subs.textToSize = textToSize
1146local function removeSpaces(str)
1147 if str then
1148 local newStr = str:gsub(" ", "")
1149 return newStr
1150 end
1151end
1152library.subs.removeSpaces = removeSpaces
1153local function Color3FromHex(hex)
1154 hex = hex:gsub("#", ""):upper():gsub("0X", "")
1155 return Color3.fromRGB(tonumber(hex:sub(1, 2), 16), tonumber(hex:sub(3, 4), 16), tonumber(hex:sub(5, 6), 16))
1156end
1157library.subs.Color3FromHex = Color3FromHex
1158local floor = math.floor
1159local function Color3ToHex(color)
1160 local r, g, b = string.format("%X", floor(color.R * 255)), string.format("%X", floor(color.G * 255)), string.format("%X", floor(color.B * 255))
1161 if #r < 2 then
1162 r = "0" .. r
1163 end
1164 if #g < 2 then
1165 g = "0" .. g
1166 end
1167 if #b < 2 then
1168 b = "0" .. b
1169 end
1170 return string.format("%s%s%s", r, g, b)
1171end
1172if Color3.ToHex and not shared.overridecolortohex then
1173 local x, e = pcall(Color3.ToHex, Color3.new())
1174 if x and type(e) == "string" and #e == 6 then
1175 Color3ToHex = Color3.ToHex
1176 end
1177end
1178library.subs.Color3ToHex = Color3ToHex
1179local isDraggingSomething = false
1180local function makeDraggable(topBarObject, object)
1181 local dragging = nil
1182 local dragInput = nil
1183 local dragStart = nil
1184 local startPosition = nil
1185 library.signals[1 + #library.signals] = topBarObject.InputBegan:Connect(function(input)
1186 if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
1187 dragging = true
1188 dragStart = input.Position
1189 startPosition = object.Position
1190 input.Changed:Connect(function()
1191 if input.UserInputState == Enum.UserInputState.End then
1192 dragging = false
1193 end
1194 end)
1195 end
1196 end)
1197 library.signals[1 + #library.signals] = topBarObject.InputChanged:Connect(function(input)
1198 if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
1199 dragInput = input
1200 end
1201 end)
1202 library.signals[1 + #library.signals] = userInputService.InputChanged:Connect(function(input)
1203 if input == dragInput and dragging then
1204 local delta = input.Position - dragStart
1205 if not isDraggingSomething and library.configuration.smoothDragging then
1206 tweenService:Create(object, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
1207 Position = UDim2.new(startPosition.X.Scale, startPosition.X.Offset + delta.X, startPosition.Y.Scale, startPosition.Y.Offset + delta.Y)
1208 }):Play()
1209 elseif not isDraggingSomething and not library.configuration.smoothDragging then
1210 object.Position = UDim2.new(startPosition.X.Scale, startPosition.X.Offset + delta.X, startPosition.Y.Scale, startPosition.Y.Offset + delta.Y)
1211 end
1212 end
1213 end)
1214end
1215library.subs.makeDraggable = makeDraggable
1216local JSONEncode, JSONDecode = nil, nil
1217do
1218 local temp_http = game:FindService("HttpService") or game:GetService("HttpService")
1219 local httpservice = temp_http
1220 if cloneref and (type(cloneref) == "function") then
1221 httpservice, temp_http = cloneref(httpservice), nil
1222 end
1223 library.Http = httpservice
1224 local JSONEncodeFunc = httpservice.JSONEncode
1225 function JSONEncode(...)
1226 return pcall(JSONEncodeFunc, httpservice, ...)
1227 end
1228 library.JSONEncode = JSONEncode
1229 local JSONDecodeFunc = httpservice.JSONDecode
1230 function JSONDecode(...)
1231 return pcall(JSONDecodeFunc, httpservice, ...)
1232 end
1233 library.JSONDecode = JSONDecode
1234end
1235local convertfilename
1236do
1237 local string_gsub = string.gsub
1238 function convertfilename(str, default, replace)
1239 replace = replace or "_"
1240 local corrections = 0
1241 local predname = string_gsub(str, "%W", function(c)
1242 local byt = c:byte()
1243 if ((byt == 0) or (byt == 32) or (byt == 33) or (byt == 59) or (byt == 61) or ((byt >= 35) and (byt <= 41)) or ((byt >= 43) and (byt <= 57)) or ((byt >= 64) and (byt <= 123)) or ((byt >= 125) and (byt <= 127))) then
1244 else
1245 corrections = 1 + corrections
1246 return replace
1247 end
1248 end)
1249 return (default and corrections == #predname and tostring(default)) or predname
1250 end
1251 library.subs.ConvertFilename = convertfilename
1252end
1253do
1254 do
1255 local function NewOption(TextStr, Order, Parent)
1256 local Option = Instance_new("Frame")
1257 local BBorder = Instance_new("Frame")
1258 local Inner_2 = Instance_new("Frame")
1259 local Border_2 = Instance_new("Frame")
1260 local Text = Instance_new("TextLabel")
1261 local Button = Instance_new("TextButton")
1262 Option.AnchorPoint = Vector2.new(0, 0.5)
1263 Option.BackgroundColor3 = library.colors.background
1264 colored[1 + #colored] = {Option, "BackgroundColor3", "background"}
1265 Option.BorderColor3 = Color3.fromRGB(27, 27, 27)
1266 Option.LayoutOrder = Order or #Parent:GetChildren()
1267 Option.Name = "Option"
1268 Option.Position = UDim2.new(0, 5, 0.5, 0)
1269 Option.Size = UDim2.new(0, 35, 0, 25)
1270 BBorder.AnchorPoint = Vector2.new(0.5, 0.5)
1271 BBorder.BackgroundColor3 = library.colors.background
1272 colored[1 + #colored] = {BBorder, "BackgroundColor3", "background"}
1273 BBorder.BorderColor3 = Color3.fromRGB(50, 43, 50)
1274 BBorder.BorderMode = Enum.BorderMode.Inset
1275 BBorder.Name = "BBorder"
1276 BBorder.Parent = Option
1277 BBorder.Position = UDim2.new(0.5, 0, 0.5, 0)
1278 BBorder.Size = UDim2.new(1, 0, 1, 0)
1279 Inner_2.AnchorPoint = Vector2.new(0.5, 0.5)
1280 Inner_2.BackgroundColor3 = library.colors.background
1281 colored[1 + #colored] = {Inner_2, "BackgroundColor3", "background"}
1282 Inner_2.BorderColor3 = Color3.fromRGB(27, 27, 27)
1283 Inner_2.Name = "Inner"
1284 Inner_2.Parent = Option
1285 Inner_2.Position = UDim2.new(0.5, 0, 0.5, 0)
1286 Inner_2.Size = UDim2.new(1, -6, 1, -6)
1287 Border_2.AnchorPoint = Vector2.new(0.5, 0.5)
1288 Border_2.BackgroundColor3 = library.colors.background
1289 colored[1 + #colored] = {Border_2, "BackgroundColor3", "background"}
1290 Border_2.BorderColor3 = Color3.fromRGB(50, 43, 50)
1291 Border_2.BorderMode = Enum.BorderMode.Inset
1292 Border_2.Name = "Border"
1293 Border_2.Parent = Inner_2
1294 Border_2.Position = UDim2.new(0.5, 0, 0.5, 0)
1295 Border_2.Size = UDim2.new(1, 0, 1, 0)
1296 Text.AnchorPoint = Vector2.new(0.5, 0.5)
1297 Text.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
1298 Text.BackgroundTransparency = 1
1299 Text.Font = Enum.Font.Code
1300 Text.FontSize = Enum.FontSize.Size14
1301 Text.Name = "Text"
1302 Text.Parent = Border_2
1303 Text.Position = UDim2.new(0.5, 0, 0.5, 0)
1304 Text.Size = UDim2.new(1, 0, 1, 0)
1305 Text.TextColor3 = library.colors.elementText
1306 colored[1 + #colored] = {Text, "TextColor3", "elementText"}
1307 Text.TextSize = 14
1308 Text.TextStrokeTransparency = 0.75
1309 Button.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
1310 Button.BackgroundTransparency = 1
1311 Button.BorderSizePixel = 0
1312 Button.Font = Enum.Font.SourceSans
1313 Button.FontSize = Enum.FontSize.Size14
1314 Button.Name = "Button"
1315 Button.Parent = Option
1316 Button.Size = UDim2.new(1, 0, 1, 0)
1317 Button.Text = ""
1318 Button.TextColor3 = Color3.fromRGB(0, 0, 0)
1319 Button.TextSize = 14
1320 Button.TextTransparency = 1
1321 Text.Text = TextStr
1322 local siz = textToSize(Text)
1323 Option.Size = UDim2.new(0, math.max(siz.X, 28) + 12, 0, 25)
1324 Option.Parent = Parent
1325 return Option, Button, Text
1326 end
1327 local function AddOption(OptionData, Key, OptionCount, Parent, Close, PromptEvent, KeepOpen)
1328 local Enabled = OptionData.Enabled
1329 if OptionData.Disabled then
1330 Enabled = false
1331 else
1332 Enabled = Enabled or (Enabled == nil)
1333 end
1334 local OptionText = OptionData.Text or OptionData.String or OptionData.Message or OptionData.Value or OptionData.Name or Key
1335 local Callback = OptionData.Callback or OptionData.OnPressed or OptionData.Function or nil
1336 local Order = tonumber(OptionData.Slot or OptionData.Order or OptionData.LayoutOrder or OptionData.Index or OptionCount)
1337 local OptionIns, OptionButton, OptionTxt = NewOption(tostring(OptionText), Order, Parent)
1338 local OptionObj = {
1339 Text = OptionText,
1340 Callback = Callback,
1341 ButtonObject = OptionIns,
1342 Pressed = OptionButton.MouseButton1Click,
1343 PressedRight = OptionButton.MouseButton2Click,
1344 Activated = OptionButton.Activated,
1345 TextButton = OptionButton,
1346 Order = Order,
1347 Enabled = Enabled
1348 }
1349 function OptionObj.Remove()
1350 do
1351 local Btn = OptionObj.ButtonObject
1352 if Btn then
1353 Btn:Destroy()
1354 end
1355 end
1356 for k in next, OptionObj do
1357 rawset(OptionObj, k, nil)
1358 end
1359 return true
1360 end
1361 local Proxy = nil
1362 local function Clicked(f)
1363 return function(...)
1364 if f then
1365 task.spawn(f, ...)
1366 end
1367 PromptEvent:Fire(Key, OptionButton.Text, ...)
1368 if KeepOpen then
1369 else
1370 Close()
1371 end
1372 end
1373 end
1374 function OptionObj.Press(...)
1375 OptionObj.Update()
1376 Proxy = Proxy or Clicked(Callback)
1377 Proxy(...)
1378 end
1379 function OptionObj.Lock()
1380 OptionObj.Enabled = false
1381 OptionObj.Update()
1382 end
1383 function OptionObj.Unlock()
1384 OptionObj.Enabled = true
1385 OptionObj.Update()
1386 end
1387 function OptionObj.SetLocked(self, state)
1388 if type(self) == "boolean" then
1389 state = self
1390 end
1391 OptionObj.Enabled = state
1392 OptionObj.Update()
1393 end
1394 function OptionObj.SetCondition(self, Condition)
1395 if type(self) ~= "table" then
1396 Condition = self
1397 end
1398 OptionObj.Condition = Condition
1399 OptionObj.Update()
1400 end
1401 function OptionObj.Update()
1402 do
1403 local OptionText = OptionObj.Text or OptionData.Text or OptionData.String or OptionData.Message or OptionData.Value or OptionData.Name or OptionButton.Text or Key
1404 OptionButton.Text = tostring(OptionText)
1405 end
1406 OptionIns.LayoutOrder = tonumber(OptionObj.Order or OptionData.Slot or OptionData.Order or OptionData.LayoutOrder or OptionData.Index or OptionIns.LayoutOrder or OptionCount)
1407 do
1408 local Enabled = OptionData.Enabled
1409 local Cond = OptionObj.Condition
1410 if Cond then
1411 local x, e = pcall(Cond, OptionObj)
1412 if x then
1413 Enabled = e and true
1414 else
1415 warn(debug.traceback(string.format("Error in prompt-option %s's Condition function: %s", OptionButton.Text, e), 2))
1416 end
1417 else
1418 if OptionData.Disabled then
1419 Enabled = false
1420 else
1421 Enabled = (Enabled and true) or (Enabled == nil)
1422 end
1423 end
1424 local Proxy = nil
1425 do
1426 local nCallback = (Enabled and (OptionData.Callback or OptionData.OnPressed or OptionData.Function)) or nil
1427 if not Proxy or Callback ~= nCallback then
1428 Callback = nCallback
1429 Proxy = Clicked(Callback)
1430 OptionObj.PressedConnection = (OptionObj.PressedConnection and OptionObj.PressedConnection:Disconnect() and nil) or (Callback and OptionObj.Pressed:Connect(Proxy)) or nil
1431 end
1432 local PC = OptionObj.PressedConnection
1433 if Enabled then
1434 if PC then
1435 if Callback then
1436 else
1437 OptionObj.PressedConnection = (PC:Disconnect() and nil) or nil
1438 end
1439 elseif Callback then
1440 Proxy = Proxy or Clicked(Callback)
1441 OptionObj.PressedConnection = OptionObj.Pressed:Connect(Proxy)
1442 end
1443 elseif PC then
1444 OptionObj.PressedConnection = (PC:Disconnect() and nil) or nil
1445 end
1446 end
1447 OptionObj.Enabled = Enabled
1448 OptionTxt.TextTransparency = (Enabled and 0) or 0.5
1449 end
1450 return OptionObj
1451 end
1452 OptionObj.Update()
1453 return OptionObj
1454 end
1455 local function SortByLayoutOrder(a, b)
1456 return a.Order < b.Order
1457 end
1458 local DefaultSelections = {
1459 Ok = true
1460 }
1461 function library.Prompt(self, PromptData, ...)
1462 if rawequal(self, library) then
1463 else
1464 PromptData, self = self, library
1465 end
1466 local PromptEvent = Instance_new("BindableEvent")
1467 local PromptObj = {
1468 OnSelect = PromptEvent.Event,
1469 Active = true,
1470 SelectedEvent = PromptEvent
1471 }
1472 local ChoicePopup = Instance_new("Frame")
1473 local Buttons = Instance_new("ScrollingFrame")
1474 local Title = Instance_new("TextLabel")
1475 local Description = Instance_new("TextLabel")
1476 local DoClose = PromptData.CloseButton
1477 DoClose = (DoClose == nil) or (DoClose == true) or DoClose or nil
1478 local Close = DoClose and Instance_new("ImageButton")
1479 do
1480 local Border = Instance_new("Frame")
1481 local Inner = Instance_new("Frame")
1482 local InnerBorder = Instance_new("Frame")
1483 local Bar = Instance_new("Frame")
1484 local Splitter = Instance_new("Frame")
1485 local ButtonBar = Instance_new("Frame")
1486 local UIListLayout = Instance_new("UIListLayout")
1487 ChoicePopup.AnchorPoint = Vector2.new(0.5, 0.5)
1488 ChoicePopup.BackgroundColor3 = library.colors.background
1489 colored[1 + #colored] = {ChoicePopup, "BackgroundColor3", "background"}
1490 ChoicePopup.BorderColor3 = library.colors.outerBorder
1491 colored[1 + #colored] = {ChoicePopup, "BorderColor3", "outerBorder"}
1492 ChoicePopup.Name = "ChoicePopup"
1493 ChoicePopup.Position = UDim2.new(0.5, 0, 0.5, 0)
1494 ChoicePopup.Size = UDim2.new(0, 325, 0, 100)
1495 Border.AnchorPoint = Vector2.new(0.5, 0.5)
1496 Border.BackgroundColor3 = library.colors.background
1497 colored[1 + #colored] = {Border, "BackgroundColor3", "background"}
1498 Border.BorderColor3 = library.colors.innerBorder
1499 colored[1 + #colored] = {Border, "BorderColor3", "innerBorder"}
1500 Border.BorderMode = Enum.BorderMode.Inset
1501 Border.Name = "Border"
1502 Border.Parent = ChoicePopup
1503 Border.Position = UDim2.new(0.5, 0, 0.5, 0)
1504 Border.Size = UDim2.new(1, 0, 1, 0)
1505 Inner.AnchorPoint = Vector2.new(0.5, 0.5)
1506 Inner.BackgroundColor3 = library.colors.background
1507 colored[1 + #colored] = {Inner, "BackgroundColor3", "background"}
1508 Inner.BorderColor3 = library.colors.outerBorder
1509 colored[1 + #colored] = {Inner, "BorderColor3", "outerBorder"}
1510 Inner.Name = "Inner"
1511 Inner.Parent = ChoicePopup
1512 Inner.Position = UDim2.new(0.5, 0, 0.5, 0)
1513 Inner.Size = UDim2.new(1, -8, 1, -8)
1514 InnerBorder.AnchorPoint = Vector2.new(0.5, 0.5)
1515 InnerBorder.BackgroundColor3 = library.colors.background
1516 colored[1 + #colored] = {InnerBorder, "BackgroundColor3", "background"}
1517 InnerBorder.BorderColor3 = library.colors.innerBorder
1518 colored[1 + #colored] = {InnerBorder, "BorderColor3", "innerBorder"}
1519 InnerBorder.BorderMode = Enum.BorderMode.Inset
1520 InnerBorder.Name = "InnerBorder"
1521 InnerBorder.Parent = Inner
1522 InnerBorder.Position = UDim2.new(0.5, 0, 0.5, 0)
1523 InnerBorder.Size = UDim2.new(1, 0, 1, 0)
1524 Bar.BackgroundColor3 = library.colors.main
1525 colored[1 + #colored] = {Bar, "BackgroundColor3", "main"}
1526 Bar.BorderSizePixel = 0
1527 Bar.Name = "Bar"
1528 Bar.Parent = InnerBorder
1529 Bar.Size = UDim2.new(1, 0, 0, 3)
1530 Splitter.AnchorPoint = Vector2.new(0, 1)
1531 Splitter.BackgroundColor3 = Color3.fromRGB(38, 38, 38)
1532 Splitter.BorderSizePixel = 0
1533 Splitter.Name = "Splitter"
1534 Splitter.Parent = InnerBorder
1535 Splitter.Position = UDim2.new(0, 0, 1, -35)
1536 Splitter.Size = UDim2.new(1, 0, 0, 1)
1537 Title.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
1538 Title.BackgroundTransparency = 1
1539 Title.Font = Enum.Font.Code
1540 Title.FontSize = Enum.FontSize.Size18
1541 Title.Parent = InnerBorder
1542 Title.Position = UDim2.new(0, 6, 0, 4)
1543 Title.Size = UDim2.new(0, 300, 0, 25)
1544 Title.TextColor3 = library.colors.elementText
1545 colored[1 + #colored] = {Title, "TextColor3", "elementText"}
1546 Title.TextSize = 15
1547 Title.TextStrokeTransparency = 0.95
1548 Title.TextXAlignment = Enum.TextXAlignment.Left
1549 Description.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
1550 Description.BackgroundTransparency = 1
1551 Description.Font = Enum.Font.Code
1552 Description.FontSize = Enum.FontSize.Size14
1553 Description.Name = "Description"
1554 Description.Parent = InnerBorder
1555 Description.Position = UDim2.new(0, 6, 0, 25)
1556 Description.Size = UDim2.new(0, 300, 0, 25)
1557 Description.TextColor3 = library.colors.elementText
1558 colored[1 + #colored] = {Description, "TextColor3", "elementText"}
1559 Description.TextSize = 14
1560 Description.TextStrokeTransparency = 0.95
1561 Description.TextTruncate = Enum.TextTruncate.AtEnd
1562 Description.TextWrap = true
1563 Description.TextWrapped = true
1564 Description.TextXAlignment = Enum.TextXAlignment.Left
1565 if Close then
1566 Close.AnchorPoint = Vector2.new(1)
1567 Close.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
1568 Close.BackgroundTransparency = 1
1569 Close.Image = "http://www.roblox.com/asset/?id=9064270627"
1570 Close.ImageColor3 = library.colors.section
1571 colored[1 + #colored] = {Close, "ImageColor3", "section"}
1572 Close.Name = "Close"
1573 Close.Parent = InnerBorder
1574 Close.Position = UDim2.new(1, -9, 0, 11)
1575 Close.ScaleType = Enum.ScaleType.Fit
1576 Close.Size = UDim2.new(0, 10, 0, 10)
1577 end
1578 ButtonBar.AnchorPoint = Vector2.new(0, 1)
1579 ButtonBar.BackgroundColor3 = library.colors.sectionBackground
1580 colored[1 + #colored] = {ButtonBar, "BackgroundColor3", "sectionBackground"}
1581 ButtonBar.BorderSizePixel = 0
1582 ButtonBar.Name = "ButtonBar"
1583 ButtonBar.Parent = InnerBorder
1584 ButtonBar.Position = UDim2.new(0, 0, 1, 0)
1585 ButtonBar.Size = UDim2.new(1, 0, 0, 35)
1586 Buttons.AutomaticCanvasSize = Enum.AutomaticSize.X
1587 Buttons.BackgroundColor3 = library.colors.sectionBackground
1588 colored[1 + #colored] = {Buttons, "BackgroundColor3", "sectionBackground"}
1589 Buttons.BorderColor3 = library.colors.background
1590 colored[1 + #colored] = {Buttons, "BorderColor3", "background"}
1591 Buttons.BorderSizePixel = 0
1592 Buttons.BottomImage = ""
1593 Buttons.CanvasSize = UDim2.new(0, 0, 0, 0)
1594 Buttons.MidImage = ""
1595 Buttons.Name = "Buttons"
1596 Buttons.Parent = ButtonBar
1597 Buttons.Position = UDim2.new(0, 6, 0, 0)
1598 Buttons.ScrollBarImageColor3 = Color3.fromRGB(0, 0, 0)
1599 Buttons.ScrollBarImageTransparency = 1
1600 Buttons.ScrollBarThickness = 0
1601 Buttons.ScrollingDirection = Enum.ScrollingDirection.X
1602 Buttons.Selectable = false
1603 Buttons.Size = UDim2.new(1, -12, 1, 0)
1604 Buttons.TopImage = ""
1605 UIListLayout.FillDirection = Enum.FillDirection.Horizontal
1606 UIListLayout.Padding = UDim.new(0, 10)
1607 UIListLayout.Parent = Buttons
1608 UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
1609 UIListLayout.VerticalAlignment = Enum.VerticalAlignment.Center
1610 end
1611 PromptObj.FrameInstance = ChoicePopup
1612 PromptObj.Closed = ChoicePopup.Destroying
1613 local function ClosePrompt(method)
1614 PromptObj.Active = (ChoicePopup and ChoicePopup:Destroy() and nil) or (PromptEvent:Fire("Close", method and (method == "timeout_")) and nil) or nil
1615 end
1616 PromptObj.Close = ClosePrompt
1617 if Close then
1618 Close.MouseButton1Click:Connect(((DoClose ~= true) and DoClose) or ClosePrompt)
1619 end
1620 do
1621 local NameTxt = PromptData.Name
1622 Title.Text = ((NameTxt ~= nil) and tostring(NameTxt)) or "Untitled Prompt"
1623 end
1624 do
1625 local DescriptionTxt = PromptData.Description
1626 if DescriptionTxt == nil then
1627 DescriptionTxt = PromptData.Text
1628 if DescriptionTxt == nil then
1629 DescriptionTxt = PromptData.String
1630 if DescriptionTxt == nil then
1631 DescriptionTxt = PromptData.Message
1632 if DescriptionTxt == nil then
1633 DescriptionTxt = PromptData.Value
1634 end
1635 end
1636 end
1637 end
1638 Description.Text = ((DescriptionTxt ~= nil) and tostring(DescriptionTxt)) or ""
1639 end
1640 do
1641 local Selections = PromptData.Options or PromptData.Buttons or PromptData.Choices
1642 if Selections then
1643 if type(Selections) ~= "table" then
1644 Selections = {
1645 OK = Selections
1646 }
1647 end
1648 else
1649 Selections = DefaultSelections
1650 end
1651 local OptionCount = 0
1652 local ButtonsProxy = {}
1653 PromptObj.Buttons = ButtonsProxy
1654 function PromptObj.ReOrder(self, SortFunc)
1655 if self ~= ButtonsProxy then
1656 SortFunc, self = self, nil
1657 end
1658 if SortFunc and (type(SortFunc) ~= "function") then
1659 SortFunc = SortByLayoutOrder
1660 end
1661 local BtnOrder = {}
1662 for _, Data in next, ButtonsProxy do
1663 BtnOrder[1 + #BtnOrder] = Data
1664 end
1665 table.sort(BtnOrder, SortFunc or SortByLayoutOrder)
1666 for Order, Data in next, BtnOrder do
1667 Data.Order = Order or Data.Order
1668 local UpdateFunc = Data.Update
1669 if UpdateFunc then
1670 spawn(UpdateFunc)
1671 else
1672 local Frame = Data.ButtonObject
1673 if Frame then
1674 Frame.LayoutOrder = Order
1675 end
1676 end
1677 end
1678 return ButtonsProxy
1679 end
1680 function PromptObj.PressAll(self, ...)
1681 local isSelf = nil
1682 if self and rawequal(self, PromptObj) then
1683 isSelf = true
1684 end
1685 for _, Data in next, ButtonsProxy do
1686 local f = Data.Callback
1687 if f then
1688 if isSelf then
1689 f(...)
1690 else
1691 f(self, ...)
1692 end
1693 end
1694 end
1695 end
1696 local KeepOpen = PromptData.KeepOpen
1697 for Key, OptionData in next, Selections do
1698 OptionCount += 1
1699 do
1700 local typ = OptionData and type(OptionData)
1701 if typ ~= "table" then
1702 OptionData = {
1703 Name = ((typ == "string") and (type(Key) == "number") and OptionData) or Key,
1704 Callback = ((typ == "function") and OptionData) or ClosePrompt
1705 }
1706 end
1707 end
1708 ButtonsProxy[Key] = AddOption(OptionData, Key, OptionCount, Buttons, ClosePrompt, PromptEvent, KeepOpen)
1709 end
1710 end
1711 do
1712 local to = PromptData.Timeout
1713 to = to and tonumber(to)
1714 if to then
1715 task.delay(to, ClosePrompt, "timeout_")
1716 end
1717 end
1718 ChoicePopup.Parent = MainScreenGui
1719 makeDraggable(ChoicePopup, ChoicePopup)
1720 return PromptObj, ChoicePopup
1721 end
1722 end
1723 do
1724 local Popups = Instance.new("Frame")
1725 local UIListLayout = Instance.new("UIListLayout")
1726 library.NotifyLayout = UIListLayout
1727 Popups.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
1728 Popups.BackgroundTransparency = 1
1729 Popups.Name = "Popups"
1730 Popups.Position = UDim2.new(0, 10, 0, 10)
1731 Popups.Size = UDim2.new(1, -20, 1, -20)
1732 UIListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Right
1733 UIListLayout.Padding = UDim.new(0, 5)
1734 UIListLayout.Parent = Popups
1735 UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
1736 UIListLayout.VerticalAlignment = Enum.VerticalAlignment.Bottom
1737 Popups.Parent = MainScreenGui
1738 library.NotificationsFrame = Popups
1739 local Inverse = true
1740 local os_clock = os.clock
1741 local Notifications = {}
1742 library.Notifications = Notifications
1743 spawn(function()
1744 local v1, vtop, htop = Enum.FillDirection.Vertical, Enum.VerticalAlignment.Top, Enum.HorizontalAlignment.Center
1745 while wait_check() do
1746 local Len = #Notifications
1747 while wait_check() and (Len <= 0) do
1748 Len = #Notifications
1749 if wait_check(0.25) then
1750 else
1751 return
1752 end
1753 end
1754 Inverse = ((UIListLayout.FillDirection == v1) and (UIListLayout.VerticalAlignment ~= vtop)) or (UIListLayout.HorizontalAlignment ~= htop)
1755 local BreathingRoom, now = 10, os_clock()
1756 local Order = 0
1757 for Index = Len, 1, -1 do
1758 BreathingRoom -= 1
1759 if BreathingRoom <= 0 then
1760 if wait_check() then
1761 BreathingRoom, now = 10, os_clock()
1762 else
1763 return
1764 end
1765 end
1766 local Noti = Notifications[Index]
1767 local Obj = Noti and Noti.Object
1768 if Obj and Noti.Active and (Noti.Paused or ((now - Noti.Expires) < Noti.Duration)) then
1769 if Noti.TextLabel.Text ~= Noti.Text then
1770 Noti:SetText(Noti.Text)
1771 end
1772 if Obj.Visible then
1773 Order += 1
1774 Obj.LayoutOrder = Order * ((Inverse and -1) or 1)
1775 end
1776 continue
1777 end
1778 Noti.Object = ((Noti.Object and Noti.Object:Destroy()) and nil) or (Noti.Destroy() and nil) or (table.remove(Notifications, Index) and nil) or nil
1779 end
1780 end
1781 end)
1782 function library.Notify(self, NotificationData, ...)
1783 if rawequal(self, library) then
1784 else
1785 NotificationData, self = self, library
1786 end
1787 local now = os_clock()
1788 local dur = NotificationData.Time or 6
1789 local TextStr = NotificationData.Text or NotificationData.String or NotificationData.Value or NotificationData.Message or NotificationData.Msg
1790 TextStr = ((TextStr == nil) and "No text given") or tostring(TextStr)
1791 local NotificationObj = {
1792 InitTime = now,
1793 Active = true,
1794 Forced = false,
1795 Duration = dur,
1796 Expires = now + dur,
1797 Paused = (NotificationData.Paused and true) or false,
1798 Text = TextStr,
1799 Arguments = NotificationData
1800 }
1801 NotificationObj.Forced = NotificationObj.Paused
1802 local Notification = Instance.new("Frame")
1803 NotificationObj.Object = Notification
1804 local Border = Instance.new("Frame")
1805 local Inner = Instance.new("Frame")
1806 local Border_2 = Instance.new("Frame")
1807 local Text = Instance.new("TextLabel")
1808 NotificationObj.TextLabel = Text
1809 local Bar = Instance.new("Frame")
1810 local Close = Instance.new("ImageButton")
1811 Notification.AnchorPoint = Vector2.one
1812 Notification.BackgroundColor3 = library.colors.background
1813 colored[1 + #colored] = {Notification, "BackgroundColor3", "background"}
1814 Notification.BorderColor3 = library.colors.outerBorder
1815 colored[1 + #colored] = {Notification, "BorderColor3", "outerBorder"}
1816 Notification.Name = "Notification"
1817 Notification.Position = UDim2.new(1, -10, 1, -10)
1818 Notification.Size = UDim2.new(0, 5e4, 0, 32)
1819 Border.AnchorPoint = Vector2.new(0.5, 0.5)
1820 Border.BackgroundColor3 = library.colors.background
1821 colored[1 + #colored] = {Border, "BackgroundColor3", "background"}
1822 Border.BorderColor3 = library.colors.innerBorder
1823 colored[1 + #colored] = {Border, "BorderColor3", "innerBorder"}
1824 Border.BorderMode = Enum.BorderMode.Inset
1825 Border.Name = "Border"
1826 Border.Parent = Notification
1827 Border.Position = UDim2.new(0.5, 0, 0.5, 0)
1828 Border.Size = UDim2.new(1, 0, 1, 0)
1829 Inner.AnchorPoint = Vector2.one / 2
1830 Inner.BackgroundColor3 = library.colors.background
1831 colored[1 + #colored] = {Inner, "BackgroundColor3", "background"}
1832 Inner.BorderColor3 = library.colors.outerBorder
1833 colored[1 + #colored] = {Inner, "BorderColor3", "outerBorder"}
1834 Inner.Name = "Inner"
1835 Inner.Parent = Notification
1836 Inner.Position = UDim2.new(0.5, 0, 0.5, 0)
1837 Inner.Size = UDim2.new(1, -8, 1, -8)
1838 Border_2.AnchorPoint = Vector2.one / 2
1839 Border_2.BackgroundColor3 = library.colors.background
1840 colored[1 + #colored] = {Border_2, "BackgroundColor3", "background"}
1841 Border_2.BorderColor3 = library.colors.innerBorder
1842 colored[1 + #colored] = {Border_2, "BorderColor3", "innerBorder"}
1843 Border_2.BorderMode = Enum.BorderMode.Inset
1844 Border_2.Name = "Border"
1845 Border_2.Parent = Inner
1846 Border_2.Position = UDim2.new(0.5, 0, 0.5, 0)
1847 Border_2.Size = UDim2.new(1, 0, 1, 0)
1848 Text.AnchorPoint = Vector2.new(0, 0.5)
1849 Text.BackgroundTransparency = 1
1850 Text.Font = Enum.Font.Code
1851 Text.FontSize = Enum.FontSize.Size14
1852 Text.Name = "Text"
1853 Text.Parent = Border_2
1854 Text.Position = UDim2.new(0, 8, 0.5, 0)
1855 Text.Size = UDim2.new(1, -8, 1, -7)
1856 Text.Text = TextStr
1857 Text.TextColor3 = library.colors.elementText
1858 colored[1 + #colored] = {Text, "TextColor3", "elementText"}
1859 Text.TextScaled = true
1860 Text.TextSize = 14
1861 Text.TextStrokeTransparency = 0.75
1862 Text.TextWrap = true
1863 Text.TextWrapped = true
1864 Text.TextXAlignment = Enum.TextXAlignment.Left
1865 Bar.BackgroundColor3 = library.colors.main
1866 colored[1 + #colored] = {Bar, "BackgroundColor3", "main"}
1867 Bar.BorderSizePixel = 0
1868 Bar.Name = "Bar"
1869 Bar.Parent = Border_2
1870 Bar.Size = UDim2.new(0, 3, 1, 0)
1871 Close.AnchorPoint = Vector2.new(1, 0.5)
1872 Close.BackgroundTransparency = 1
1873 Close.Image = "rbxassetid://5492252477"
1874 Close.ImageColor3 = library.colors.elementText
1875 colored[1 + #colored] = {Close, "ImageColor3", "elementText"}
1876 Close.Name = "Close"
1877 Close.Parent = Border_2
1878 Close.Position = UDim2.new(1, -6, 0.5, 0)
1879 Close.ScaleType = Enum.ScaleType.Fit
1880 Close.Size = UDim2.new(0, 10, 0, 10)
1881 Notification.Size = UDim2.new(0, 64 + textToSize(Text).X, 0, 32)
1882 Notification.Parent = Popups
1883 Notification.LayoutOrder = #Notification.Parent:GetChildren() * ((Inverse and 1) or -1)
1884 if Popups.Parent then
1885 else
1886 Popups.Parent = MainScreenGui
1887 end
1888 NotificationObj.OnClose = Close.Activated
1889 NotificationObj.InputBegan = Notification.InputBegan
1890 NotificationObj.Destroying = Notification.Destroying
1891 NotificationObj.MouseEnter = Notification.MouseEnter
1892 NotificationObj.MouseLeave = Notification.MouseLeave
1893 function NotificationObj.SetText(self, Str)
1894 if rawequal(self, NotificationObj) then
1895 else
1896 Str = self
1897 end
1898 Str = ((Str == nil) and "No text given") or tostring(Str)
1899 Text.Text, NotificationObj.Text = Str, Str
1900 Notification.Size = UDim2.new(0, 44 + Text.TextBounds.X, 0, 32)
1901 return Str, Text
1902 end
1903 local function Pause(self, Set, NoForce)
1904 if rawequal(self, NotificationObj) then
1905 else
1906 Set, NoForce = self, Set
1907 end
1908 local IsPaused = NotificationObj.Paused
1909 if Set == nil then
1910 Set = not IsPaused
1911 else
1912 Set = Set or false
1913 end
1914 if Set or (IsPaused == Set) then
1915 else
1916 NotificationObj.Expires = math.max(NotificationObj.Expires, os_clock() + math.clamp(NotificationObj.Duration / 2.5, 1, 3))
1917 end
1918 NotificationObj.Paused = Set
1919 if NoForce then
1920 else
1921 NotificationObj.Forced = Set
1922 end
1923 return Set
1924 end
1925 NotificationObj.SetPaused = Pause
1926 function NotificationObj.AddTime(self, Extension)
1927 if rawequal(self, NotificationObj) then
1928 else
1929 Extension = self
1930 end
1931 NotificationObj.Expires += Extension
1932 end
1933 function NotificationObj.Hide(self, SetPause)
1934 if Notification and NotificationObj.Active then
1935 if rawequal(self, NotificationObj) then
1936 else
1937 SetPause = self
1938 end
1939 if SetPause then
1940 Pause(true)
1941 end
1942 Notification.Visible = false
1943 end
1944 end
1945 function NotificationObj.Show(self, SetPause)
1946 if Notification and NotificationObj.Active then
1947 if rawequal(self, NotificationObj) then
1948 else
1949 SetPause = self
1950 end
1951 if SetPause then
1952 Pause(false)
1953 end
1954 Notification.Visible = true
1955 end
1956 end
1957 function NotificationObj.SetVisible(self, Visible, SetPause)
1958 if Notification and NotificationObj.Active then
1959 if rawequal(self, NotificationObj) then
1960 else
1961 Visible, SetPause = self, Visible
1962 end
1963 if Visible == nil then
1964 Notification.Visible = not Notification.Visible
1965 else
1966 Notification.Visible = (Visible and true) or false
1967 end
1968 if SetPause then
1969 Pause(Notification.Visible)
1970 end
1971 end
1972 end
1973 Notification.MouseEnter:Connect(function()
1974 if NotificationObj.Forced then
1975 return
1976 end
1977 Pause(true, true)
1978 end)
1979 Notification.MouseLeave:Connect(function()
1980 if NotificationObj.Forced then
1981 return
1982 end
1983 Pause(false, true)
1984 end)
1985 local function Destroy()
1986 if Notification then
1987 Notification:Destroy()
1988 end
1989 NotificationObj.Active = false
1990 NotificationObj.Object = nil
1991 end
1992 NotificationObj.Destroy = Destroy
1993 Close.Activated:Connect(Destroy)
1994 Notifications[1 + #Notifications] = NotificationObj
1995 return NotificationObj, Notification, Text
1996 end
1997 end
1998end
1999function library:CreateWindow(options, ...)
2000 options = (options and type(options) == "string" and resolvevararg("Window", options, ...)) or options
2001 local homepage = nil
2002 local windowoptions = options
2003 local windowName = options.Name or "Unnamed Window"
2004 options.Name = windowName
2005 if windowName and #windowName > 0 and library.WorkspaceName == "Pepsi Lib" then
2006 library.WorkspaceName = convertfilename(windowName, "Pepsi Lib")
2007 end
2008 local pepsiLibrary = Instance_new("ScreenGui")
2009 library.MainScreenGui, MainScreenGui = pepsiLibrary, pepsiLibrary
2010 local main = Instance_new("Frame")
2011 local mainBorder = Instance_new("Frame")
2012 local tabSlider = Instance_new("Frame")
2013 local innerMain = Instance_new("Frame")
2014 local innerMainBorder = Instance_new("Frame")
2015 local innerBackdrop = Instance_new("ImageLabel")
2016 local innerMainHolder = Instance_new("Frame")
2017 local tabsHolder = Instance_new("ImageLabel")
2018 local tabHolderList = Instance_new("UIListLayout")
2019 local tabHolderPadding = Instance_new("UIPadding")
2020 local headline = Instance_new("TextLabel")
2021 local splitter = Instance_new("TextLabel")
2022 local submenuOpen = nil
2023 library.globals["__Window" .. options.Name] = {
2024 submenuOpen = submenuOpen
2025 }
2026 pepsiLibrary.Name = " "
2027 pepsiLibrary.Parent = library.gui_parent
2028 pepsiLibrary.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
2029 pepsiLibrary.DisplayOrder = 10
2030 pepsiLibrary.ResetOnSpawn = false
2031 main.Name = "main"
2032 main.Parent = pepsiLibrary
2033 main.AnchorPoint = Vector2.new(0.5, 0.5)
2034 main.BackgroundColor3 = library.colors.background
2035 colored[1 + #colored] = {main, "BackgroundColor3", "background"}
2036 main.BorderColor3 = library.colors.outerBorder
2037 colored[1 + #colored] = {main, "BorderColor3", "outerBorder"}
2038 main.Position = UDim2.fromScale(0.5, 0.5)
2039 main.Size = UDim2.fromOffset(500, 545)
2040 makeDraggable(main, main)
2041 mainBorder.Name = "mainBorder"
2042 mainBorder.Parent = main
2043 mainBorder.AnchorPoint = Vector2.new(0.5, 0.5)
2044 mainBorder.BackgroundColor3 = library.colors.background
2045 colored[1 + #colored] = {mainBorder, "BackgroundColor3", "background"}
2046 mainBorder.BorderColor3 = library.colors.innerBorder
2047 colored[1 + #colored] = {mainBorder, "BorderColor3", "innerBorder"}
2048 mainBorder.BorderMode = Enum.BorderMode.Inset
2049 mainBorder.Position = UDim2.fromScale(0.5, 0.5)
2050 mainBorder.Size = UDim2.fromScale(1, 1)
2051 innerMain.Name = "innerMain"
2052 innerMain.Parent = main
2053 innerMain.AnchorPoint = Vector2.new(0.5, 0.5)
2054 innerMain.BackgroundColor3 = library.colors.background
2055 colored[1 + #colored] = {innerMain, "BackgroundColor3", "background"}
2056 innerMain.BorderColor3 = library.colors.outerBorder
2057 colored[1 + #colored] = {innerMain, "BorderColor3", "outerBorder"}
2058 innerMain.Position = UDim2.fromScale(0.5, 0.5)
2059 innerMain.Size = UDim2.new(1, -14, 1, -14)
2060 innerMainBorder.Name = "innerMainBorder"
2061 innerMainBorder.Parent = innerMain
2062 innerMainBorder.AnchorPoint = Vector2.new(0.5, 0.5)
2063 innerMainBorder.BackgroundColor3 = library.colors.background
2064 colored[1 + #colored] = {innerMainBorder, "BackgroundColor3", "background"}
2065 innerMainBorder.BorderColor3 = library.colors.innerBorder
2066 colored[1 + #colored] = {innerMainBorder, "BorderColor3", "innerBorder"}
2067 innerMainBorder.BorderMode = Enum.BorderMode.Inset
2068 innerMainBorder.Position = UDim2.fromScale(0.5, 0.5)
2069 innerMainBorder.Size = UDim2.fromScale(1, 1)
2070 innerMainHolder.Name = "innerMainHolder"
2071 innerMainHolder.Parent = innerMain
2072 innerMainHolder.BackgroundColor3 = Color3.new(1, 1, 1)
2073 innerMainHolder.BackgroundTransparency = 1
2074 innerMainHolder.Position = UDim2:fromOffset(25)
2075 innerMainHolder.Size = UDim2.new(1, 0, 1, -25)
2076 innerBackdrop.Name = "innerBackdrop"
2077 innerBackdrop.Parent = innerMainHolder
2078 innerBackdrop.BackgroundColor3 = Color3.new(1, 1, 1)
2079 innerBackdrop.BackgroundTransparency = 1
2080 innerBackdrop.Size = UDim2.fromScale(1, 1)
2081 innerBackdrop.ZIndex = -1
2082 innerBackdrop.Visible = library_flags["__Designer.Background.UseBackgroundImage"] and true
2083 innerBackdrop.ImageColor3 = library_flags["__Designer.Background.ImageColor"] or Color3.new(1, 1, 1)
2084 innerBackdrop.ImageTransparency = (library_flags["__Designer.Background.ImageTransparency"] or 95) / 100
2085 innerBackdrop.Image = resolveid(library_flags["__Designer.Background.ImageAssetID"], "__Designer.Background.ImageAssetID") or ""
2086 library.Backdrop = innerBackdrop
2087 tabsHolder.Name = "tabsHolder"
2088 tabsHolder.Parent = innerMain
2089 tabsHolder.BackgroundColor3 = library.colors.topGradient
2090 colored[1 + #colored] = {tabsHolder, "BackgroundColor3", "topGradient"}
2091 tabsHolder.BorderSizePixel = 0
2092 tabsHolder.Position = UDim2.fromOffset(1, 1)
2093 tabsHolder.Size = UDim2.new(1, -2, 0, 23)
2094 tabsHolder.Image = "rbxassetid://2454009026"
2095 tabsHolder.ImageColor3 = library.colors.bottomGradient
2096 colored[1 + #colored] = {tabsHolder, "ImageColor3", "bottomGradient"}
2097 tabHolderList.Name = "tabHolderList"
2098 tabHolderList.Parent = tabsHolder
2099 tabHolderList.FillDirection = Enum.FillDirection.Horizontal
2100 tabHolderList.SortOrder = Enum.SortOrder.LayoutOrder
2101 tabHolderList.VerticalAlignment = Enum.VerticalAlignment.Center
2102 tabHolderList.Padding = UDim:new(3)
2103 tabHolderPadding.Name = "tabHolderPadding"
2104 tabHolderPadding.Parent = tabsHolder
2105 tabHolderPadding.PaddingLeft = UDim:new(7)
2106 headline.Name = "headline"
2107 headline.Parent = tabsHolder
2108 headline.BackgroundColor3 = Color3.new(1, 1, 1)
2109 headline.BackgroundTransparency = 1
2110 headline.LayoutOrder = 1
2111 headline.Font = Enum.Font.Code
2112 headline.Text = (windowName and tostring(windowName)) or "???"
2113 headline.TextColor3 = library.colors.main
2114 colored[1 + #colored] = {headline, "TextColor3", "main"}
2115 headline.TextSize = 14
2116 headline.TextStrokeColor3 = library.colors.outerBorder
2117 colored[1 + #colored] = {headline, "TextStrokeColor3", "outerBorder"}
2118 headline.TextStrokeTransparency = 0.75
2119 headline.Size = UDim2:new(textToSize(headline).X + 4, 1)
2120 splitter.Name = "splitter"
2121 splitter.Parent = tabsHolder
2122 splitter.BackgroundColor3 = Color3.new(1, 1, 1)
2123 splitter.BackgroundTransparency = 1
2124 splitter.LayoutOrder = 2
2125 splitter.Size = UDim2:new(6, 1)
2126 splitter.Font = Enum.Font.Code
2127 splitter.Text = "|"
2128 splitter.TextColor3 = library.colors.tabText
2129 colored[1 + #colored] = {splitter, "TextColor3", "tabText"}
2130 splitter.TextSize = 14
2131 splitter.TextStrokeColor3 = library.colors.tabText
2132 colored[1 + #colored] = {splitter, "TextStrokeColor3", "tabText"}
2133 splitter.TextStrokeTransparency = 0.75
2134 tabSlider.Name = "tabSlider"
2135 tabSlider.Parent = main
2136 tabSlider.BackgroundColor3 = library.colors.main
2137 colored[1 + #colored] = {tabSlider, "BackgroundColor3", "main"}
2138 tabSlider.BorderSizePixel = 0
2139 tabSlider.Position = UDim2.fromOffset(100, 30)
2140 tabSlider.Size = UDim2:fromOffset(1)
2141 tabSlider.Visible = false
2142 local IgnoreCoreInputs = nil
2143 do
2144 local os_clock = os.clock
2145 library.signals[1 + #library.signals] = userInputService.InputBegan:Connect(function(keyCode)
2146 if IgnoreCoreInputs or userInputService:GetFocusedTextBox() then
2147 return
2148 elseif keyCode.KeyCode == library.configuration.hideKeybind then
2149 if not lasthidebing or ((os_clock() - lasthidebing) > 12) then
2150 main.Visible = not main.Visible
2151 end
2152 lasthidebing = nil
2153 end
2154 end)
2155 end
2156 local windowFunctions = {
2157 tabCount = 0,
2158 selected = {},
2159 Flags = elements
2160 }
2161 library.globals["__Window" .. windowName].windowFunctions = windowFunctions
2162 function windowFunctions:Show(x)
2163 main.Visible = (x == nil) or (x == true) or (x == 1)
2164 return main.Visible
2165 end
2166 function windowFunctions:Hide(x)
2167 main.Visible = (x == false) or (x == 0)
2168 return main.Visible
2169 end
2170 function windowFunctions:Visibility(x)
2171 if x == nil then
2172 main.Visible = not main.Visible
2173 else
2174 main.Visible = x and true
2175 end
2176 return main.Visible
2177 end
2178 function windowFunctions:MoveTabSlider(tabObject)
2179 spawn(function()
2180 tabSlider.Visible = true
2181 tweenService:Create(tabSlider, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
2182 Size = UDim2.fromOffset(tabObject.AbsoluteSize.X, 1),
2183 Position = UDim2.fromOffset(tabObject.AbsolutePosition.X, tabObject.AbsolutePosition.Y + tabObject.AbsoluteSize.Y) - UDim2.fromOffset(main.AbsolutePosition.X, main.AbsolutePosition.Y)
2184 }):Play()
2185 end)
2186 end
2187 windowFunctions.LastTab = nil
2188 function windowFunctions:CreateTab(options, ...)
2189 options = (options and (type(options) == "string") and resolvevararg("Tab", options, ...)) or options or {
2190 Name = "Pepsi Style: Elite Lego Hax"
2191 }
2192 local image = options.Image
2193 if image then
2194 image = resolveid(image)
2195 end
2196 local tabName = options.Name or "Unnamed Tab"
2197 options.Name = tabName
2198 windowFunctions.tabCount = windowFunctions.tabCount + 1
2199 local newTab = Instance_new((image and "ImageButton") or "TextButton")
2200 local newTabHolder = Instance_new("Frame")
2201 library.globals["__Window" .. windowName].newTabHolder = newTabHolder
2202 local left = Instance_new("ScrollingFrame")
2203 local leftList = Instance_new("UIListLayout")
2204 local leftPadding = Instance_new("UIPadding")
2205 local right = Instance_new("ScrollingFrame")
2206 local rightList = Instance_new("UIListLayout")
2207 local rightPadding = Instance_new("UIPadding")
2208 newTab.Name = removeSpaces((tabName and tostring(tabName):lower() or "???") .. "Tab")
2209 newTab.Parent = tabsHolder
2210 newTab.BackgroundTransparency = 1
2211 newTab.LayoutOrder = (options.LastTab and 99999) or tonumber(options.TabOrder or options.LayoutOrder) or (2 + windowFunctions.tabCount)
2212 local colored_newTab_TextColor3 = nil
2213 if image then
2214 newTab.Image = image
2215 newTab.ImageColor3 = options.ImageColor or options.Color or Color3.new(1, 1, 1)
2216 newTab.Size = UDim2:new(tabsHolder.AbsoluteSize.Y, 1)
2217 else
2218 colored_newTab_TextColor3 = {newTab, "TextColor3", "tabText"}
2219 colored[1 + #colored] = colored_newTab_TextColor3
2220 newTab.Font = Enum.Font.Code
2221 newTab.Text = (tabName and tostring(tabName)) or "???"
2222 if windowFunctions.tabCount ~= 1 then
2223 colored_newTab_TextColor3[4] = 1.35
2224 newTab.TextColor3 = darkenColor(library.colors.tabText, 1.35)
2225 else
2226 newTab.TextColor3 = library.colors.tabText
2227 end
2228 newTab.TextSize = 14
2229 newTab.TextStrokeColor3 = Color3.fromRGB(42, 42, 42)
2230 newTab.TextStrokeTransparency = 0.75
2231 newTab.Size = UDim2:new(textToSize(newTab).X + 4, 1)
2232 end
2233 local function goto()
2234 if not library.colorpicker and not submenuOpen and (windowFunctions.selected.button ~= newTab) and newTab.Parent and newTabHolder.Parent then
2235 pcall(function()
2236 for _, e in next, library.elements do
2237 if e and (type(e) == "table") then
2238 if e.Update then
2239 pcall(e.Update)
2240 end
2241 if e.UpdateAll then
2242 pcall(e.UpdateAll)
2243 end
2244 end
2245 end
2246 end)
2247 if windowFunctions.LastTab then
2248 windowFunctions.LastTab[4] = 1.35
2249 end
2250 windowFunctions:MoveTabSlider(newTab)
2251 if windowFunctions.selected.button.ClassName == "TextButton" then
2252 tweenService:Create(windowFunctions.selected.button, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
2253 TextColor3 = darkenColor(library.colors.tabText, 1.35)
2254 }):Play()
2255 end
2256 if colored_newTab_TextColor3 then
2257 colored_newTab_TextColor3[4] = nil
2258 end
2259 windowFunctions.selected.holder.Visible = false
2260 windowFunctions.selected.button = newTab
2261 windowFunctions.selected.holder = newTabHolder
2262 if windowFunctions.selected.button.ClassName == "TextButton" then
2263 tweenService:Create(windowFunctions.selected.button, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
2264 TextColor3 = library.colors.tabText
2265 }):Play()
2266 end
2267 windowFunctions.selected.holder.Visible = true
2268 windowFunctions.LastTab = colored_newTab_TextColor3
2269 end
2270 end
2271 if not homepage and newTab.LayoutOrder <= 4 then
2272 homepage = goto
2273 end
2274 library.signals[1 + #library.signals] = newTab.MouseButton1Click:Connect(goto)
2275 if windowFunctions.tabCount == 1 then
2276 tabSlider.Size = UDim2.fromOffset(newTab.AbsoluteSize.X, 1)
2277 tabSlider.Position = UDim2.fromOffset(newTab.AbsolutePosition.X, newTab.AbsolutePosition.Y + newTab.AbsoluteSize.Y) - UDim2.fromOffset(main.AbsolutePosition.X, main.AbsolutePosition.Y)
2278 tabSlider.Visible = true
2279 windowFunctions.selected.holder = newTabHolder
2280 windowFunctions.selected.button = newTab
2281 end
2282 newTabHolder.Name = removeSpaces((tabName and tabName:lower()) or "???") .. "TabHolder"
2283 newTabHolder.Parent = innerMainHolder
2284 newTabHolder.BackgroundColor3 = Color3.new(1, 1, 1)
2285 newTabHolder.BackgroundTransparency = 1
2286 newTabHolder.Size = UDim2.fromScale(1, 1)
2287 newTabHolder.Visible = windowFunctions.tabCount == 1
2288 left.Name = "left"
2289 left.Parent = newTabHolder
2290 left.BackgroundColor3 = Color3.new(1, 1, 1)
2291 left.BackgroundTransparency = 1
2292 left.Size = UDim2.fromScale(0.5, 1)
2293 left.CanvasSize = UDim2.new()
2294 left.ScrollBarThickness = 0
2295 leftList.Name = "leftList"
2296 leftList.Parent = left
2297 leftList.HorizontalAlignment = Enum.HorizontalAlignment.Center
2298 leftList.SortOrder = Enum.SortOrder.LayoutOrder
2299 leftList.Padding = UDim:new(14)
2300 leftPadding.Name = "leftPadding"
2301 leftPadding.Parent = left
2302 leftPadding.PaddingTop = UDim:new(12)
2303 right.Name = "right"
2304 right.Parent = newTabHolder
2305 right.BackgroundColor3 = Color3.new(1, 1, 1)
2306 right.BackgroundTransparency = 1
2307 right.Size = UDim2.fromScale(0.5, 1)
2308 right.CanvasSize = UDim2.new()
2309 right.ScrollBarThickness = 0
2310 right.Position = UDim2.new(0.5)
2311 rightList.Name = "rightList"
2312 rightList.Parent = right
2313 rightList.HorizontalAlignment = Enum.HorizontalAlignment.Center
2314 rightList.SortOrder = Enum.SortOrder.LayoutOrder
2315 rightList.Padding = UDim:new(14)
2316 rightPadding.Name = "rightPadding"
2317 rightPadding.Parent = right
2318 rightPadding.PaddingTop = UDim:new(12)
2319 local tabFunctions = {
2320 Flags = {},
2321 Remove = function()
2322 local relod = nil
2323 if newTab then
2324 newTab.Parent = nil
2325 relod = true
2326 end
2327 if newTabHolder then
2328 newTabHolder.Parent = nil
2329 relod = true
2330 end
2331 if relod then
2332 windowFunctions:UpdateAll()
2333 end
2334 end,
2335 Select = goto
2336 }
2337 function tabFunctions:CreateSection(options, ...)
2338 options = (options and type(options) == "string" and resolvevararg("Tab", options, ...)) or options
2339 local sectionName, holderSide = options.Name or "Unnamed Section", options.Side
2340 options.Name = sectionName
2341 local newSection = Instance_new("Frame")
2342 local newSectionBorder = Instance_new("Frame")
2343 local insideBorderHider = Instance_new("Frame")
2344 local outsideBorderHider = Instance_new("Frame")
2345 local sectionHolder = Instance_new("Frame")
2346 local sectionList = Instance_new("UIListLayout")
2347 local sectionPadding = Instance_new("UIPadding")
2348 local sectionHeadline = Instance_new("TextLabel")
2349 colorpickerconflicts[1 + #colorpickerconflicts] = insideBorderHider
2350 colorpickerconflicts[1 + #colorpickerconflicts] = outsideBorderHider
2351 colorpickerconflicts[1 + #colorpickerconflicts] = sectionHeadline
2352 newSection.Name = removeSpaces((sectionName and sectionName:lower() or "???") .. "Section")
2353 newSection.Parent = (holderSide and (((holderSide:lower() == "left") and left) or right)) or left
2354 newSection.BackgroundColor3 = library.colors.sectionBackground
2355 colored[1 + #colored] = {newSection, "BackgroundColor3", "sectionBackground"}
2356 newSection.BorderColor3 = library.colors.outerBorder
2357 colored[1 + #colored] = {newSection, "BorderColor3", "outerBorder"}
2358 newSection.Size = UDim2.new(1, -20)
2359 newSection.Visible = false
2360 newSectionBorder.Name = "newSectionBorder"
2361 newSectionBorder.Parent = newSection
2362 newSectionBorder.BackgroundColor3 = library.colors.sectionBackground
2363 colored[1 + #colored] = {newSectionBorder, "BackgroundColor3", "sectionBackground"}
2364 newSectionBorder.BorderColor3 = library.colors.innerBorder
2365 colored[1 + #colored] = {newSectionBorder, "BorderColor3", "innerBorder"}
2366 newSectionBorder.BorderMode = Enum.BorderMode.Inset
2367 newSectionBorder.Size = UDim2.fromScale(1, 1)
2368 sectionHolder.Name = "sectionHolder"
2369 sectionHolder.Parent = newSection
2370 sectionHolder.BackgroundColor3 = Color3.new(1, 1, 1)
2371 sectionHolder.BackgroundTransparency = 1
2372 sectionHolder.Size = UDim2.fromScale(1, 1)
2373 sectionList.Name = "sectionList"
2374 sectionList.Parent = sectionHolder
2375 sectionList.HorizontalAlignment = Enum.HorizontalAlignment.Center
2376 sectionList.SortOrder = Enum.SortOrder.LayoutOrder
2377 sectionList.Padding = UDim:new(1)
2378 sectionPadding.Name = "sectionPadding"
2379 sectionPadding.Parent = sectionHolder
2380 sectionPadding.PaddingTop = UDim:new(9)
2381 sectionHeadline.Name = "sectionHeadline"
2382 sectionHeadline.Parent = newSection
2383 sectionHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
2384 sectionHeadline.BackgroundTransparency = 1
2385 sectionHeadline.Position = UDim2.fromOffset(18, -8)
2386 sectionHeadline.ZIndex = 2
2387 sectionHeadline.Font = Enum.Font.Code
2388 sectionHeadline.LineHeight = 1.15
2389 sectionHeadline.Text = (sectionName and sectionName or "???")
2390 sectionHeadline.TextColor3 = library.colors.section
2391 colored[1 + #colored] = {sectionHeadline, "TextColor3", "section"}
2392 sectionHeadline.TextSize = 14
2393 sectionHeadline.Size = UDim2.fromOffset(textToSize(sectionHeadline).X + 4, 12)
2394 insideBorderHider.Name = "insideBorderHider"
2395 insideBorderHider.Parent = newSection
2396 insideBorderHider.BackgroundColor3 = library.colors.sectionBackground
2397 colored[1 + #colored] = {insideBorderHider, "BackgroundColor3", "sectionBackground"}
2398 insideBorderHider.BorderSizePixel = 0
2399 insideBorderHider.Position = UDim2.fromOffset(15)
2400 insideBorderHider.Size = UDim2.fromOffset(sectionHeadline.AbsoluteSize.X + 3, 1)
2401 outsideBorderHider.Name = "outsideBorderHider"
2402 outsideBorderHider.Parent = newSection
2403 outsideBorderHider.BackgroundColor3 = library.colors.background
2404 colored[1 + #colored] = {outsideBorderHider, "BackgroundColor3", "background"}
2405 outsideBorderHider.BorderSizePixel = 0
2406 outsideBorderHider.Position = UDim2.fromOffset(15, -1)
2407 outsideBorderHider.Size = UDim2.fromOffset(sectionHeadline.AbsoluteSize.X + 3, 1)
2408 local sectionFunctions = {
2409 Flags = {},
2410 Remove = function()
2411 if newSection then
2412 newSection.Parent = nil
2413 windowFunctions:UpdateAll()
2414 end
2415 end
2416 }
2417 function sectionFunctions:Update(extra)
2418 local currentHolder = newSection.Parent
2419 if not newSection.Visible then
2420 newSection.Visible = true
2421 end
2422 newSection.Size = UDim2.new(1, -20, 0, (15 + sectionList.AbsoluteContentSize.Y))
2423 if currentHolder then
2424 currentHolder.CanvasSize = UDim2:fromOffset(currentHolder:FindFirstChildOfClass("UIListLayout").AbsoluteContentSize.Y + 22 + (tonumber(extra) or 0))
2425 end
2426 end
2427 function sectionFunctions:UpdateAll(...)
2428 for _, obj in next, sectionFunctions.Flags do
2429 if obj then
2430 if obj.Update then
2431 pcall(obj.Update)
2432 end
2433 if obj.UpdateAll then
2434 pcall(obj.UpdateAll)
2435 end
2436 end
2437 end
2438 sectionFunctions:Update(...)
2439 end
2440 function sectionFunctions:AddToggle(options, ...)
2441 options = (options and type(options) == "string" and resolvevararg("Tab", options, ...)) or options
2442 local toggleName, alreadyEnabled, callback, flagName = assert(options.Name, "Missing Name for new toggle."), options.Value or options.Enabled, options.Callback, options.Flag or (function()
2443 library.unnamedtoggles = 1 + (library.unnamedtoggles or 0)
2444 return "Toggle" .. tostring(library.unnamedtoggles)
2445 end)()
2446 if elements[flagName] ~= nil then
2447 warn(debug.traceback("Warning! Re-used flag '" .. flagName .. "'", 3))
2448 end
2449 local newToggle = Instance_new("Frame")
2450 local toggle = Instance_new("ImageLabel")
2451 local toggleInner = Instance_new("ImageLabel")
2452 local toggleButton = Instance_new("TextButton")
2453 local toggleHeadline = Instance_new("TextLabel")
2454 local keybindPositioner = Instance_new("Frame")
2455 local keybindList = Instance_new("UIListLayout")
2456 local keybindButton = Instance_new("TextButton")
2457 local lockedup = options.Locked
2458 newToggle.Name = removeSpaces((toggleName and toggleName:lower() or "???") .. "Toggle")
2459 newToggle.Parent = sectionHolder
2460 newToggle.BackgroundColor3 = Color3.new(1, 1, 1)
2461 newToggle.BackgroundTransparency = 1
2462 newToggle.Size = UDim2.new(1, 0, 0, 19)
2463 toggle.Name = "toggle"
2464 toggle.Parent = newToggle
2465 toggle.Active = true
2466 toggle.BackgroundColor3 = library.colors.topGradient
2467 local colored_toggle_BackgroundColor3 = {toggle, "BackgroundColor3", "topGradient"}
2468 colored[1 + #colored] = colored_toggle_BackgroundColor3
2469 toggle.BorderColor3 = library.colors.elementBorder
2470 colored[1 + #colored] = {toggle, "BorderColor3", "elementBorder"}
2471 toggle.Position = UDim2.fromScale(0.0308237672, 0.165842205)
2472 toggle.Selectable = true
2473 toggle.Size = UDim2.fromOffset(12, 12)
2474 toggle.Image = "rbxassetid://2454009026"
2475 toggle.ImageColor3 = library.colors.bottomGradient
2476 local colored_toggle_ImageColor3 = {toggle, "ImageColor3", "bottomGradient"}
2477 colored[1 + #colored] = colored_toggle_ImageColor3
2478 toggleInner.Name = "toggleInner"
2479 toggleInner.Parent = toggle
2480 toggleInner.Active = true
2481 toggleInner.AnchorPoint = Vector2.new(0.5, 0.5)
2482 toggleInner.BackgroundColor3 = library.colors.topGradient
2483 local colored_toggleInner_BackgroundColor3 = {toggleInner, "BackgroundColor3", "topGradient"}
2484 colored[1 + #colored] = colored_toggleInner_BackgroundColor3
2485 toggleInner.BorderColor3 = library.colors.elementBorder
2486 colored[1 + #colored] = {toggleInner, "BorderColor3", "elementBorder"}
2487 toggleInner.Position = UDim2.fromScale(0.5, 0.5)
2488 toggleInner.Selectable = true
2489 toggleInner.Size = UDim2.new(1, -4, 1, -4)
2490 toggleInner.Image = "rbxassetid://2454009026"
2491 toggleInner.ImageColor3 = library.colors.bottomGradient
2492 local colored_toggleInner_ImageColor3 = {toggleInner, "ImageColor3", "bottomGradient"}
2493 colored[1 + #colored] = colored_toggleInner_ImageColor3
2494 toggleButton.Name = "toggleButton"
2495 toggleButton.Parent = newToggle
2496 toggleButton.BackgroundColor3 = Color3.new(1, 1, 1)
2497 toggleButton.BackgroundTransparency = 1
2498 toggleButton.Size = UDim2.fromScale(1, 1)
2499 toggleButton.ZIndex = 5
2500 toggleButton.Font = Enum.Font.SourceSans
2501 toggleButton.Text = ""
2502 toggleButton.TextColor3 = Color3.new()
2503 toggleButton.TextSize = 14
2504 toggleButton.TextTransparency = 1
2505 toggleHeadline.Name = "toggleHeadline"
2506 toggleHeadline.Parent = newToggle
2507 toggleHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
2508 toggleHeadline.BackgroundTransparency = 1
2509 toggleHeadline.Position = UDim2.fromScale(0.123, 0.165842161)
2510 toggleHeadline.Size = UDim2.fromOffset(170, 11)
2511 toggleHeadline.Font = Enum.Font.Code
2512 toggleHeadline.Text = toggleName or "???"
2513 toggleHeadline.TextColor3 = library.colors.elementText
2514 local colored_toggleHeadline_TextColor3 = {toggleHeadline, "TextColor3", "elementText", (lockedup and 0.5) or nil}
2515 colored[1 + #colored] = colored_toggleHeadline_TextColor3
2516 toggleHeadline.TextSize = 14
2517 toggleHeadline.TextXAlignment = Enum.TextXAlignment.Left
2518 local last_v = nil
2519 local function Set(t, newStatus)
2520 if nil == newStatus and t ~= nil then
2521 newStatus = t
2522 end
2523 last_v = library_flags[flagName]
2524 if options.Condition ~= nil then
2525 if type(options.Condition) == "function" then
2526 local v, e = pcall(options.Condition, newStatus, last_v)
2527 if e then
2528 if not v then
2529 warn(debug.traceback(string.format("Error in toggle %s's Condition function: %s", flagName, e), 2))
2530 end
2531 else
2532 return last_v
2533 end
2534 end
2535 end
2536 if newStatus ~= nil and type(newStatus) == "boolean" then
2537 library_flags[flagName] = newStatus
2538 if options.Location then
2539 options.Location[options.LocationFlag or flagName] = newStatus
2540 end
2541 if callback and (last_v ~= newStatus or options.AllowDuplicateCalls) then
2542 colored_toggleInner_BackgroundColor3[3] = (newStatus and "main") or "topGradient"
2543 colored_toggleInner_BackgroundColor3[4] = (newStatus and 1.5) or nil
2544 colored_toggleInner_ImageColor3[3] = (newStatus and "main") or "bottomGradient"
2545 colored_toggleInner_ImageColor3[4] = (newStatus and 2.5) or nil
2546 tweenService:Create(toggleInner, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
2547 BackgroundColor3 = (newStatus and darkenColor(library.colors.main, 1.5)) or library.colors.topGradient,
2548 ImageColor3 = (newStatus and darkenColor(library.colors.main, 2.5)) or library.colors.bottomGradient
2549 }):Play()
2550 task.spawn(callback, newStatus, last_v)
2551 end
2552 end
2553 return newStatus
2554 end
2555 options.Keybind = options.Keybind or options.Key or options.KeyBind
2556 local haskbflag, kbUpdate, kbData = nil, nil, nil
2557 if options.Keybind then
2558 local options = options.Keybind
2559 local htyp = typeof(options)
2560 if htyp == "EnumItem" then
2561 options = {
2562 Value = options
2563 }
2564 elseif htyp ~= "table" then
2565 options = {}
2566 end
2567 local presetKeybind, callback, kbpresscallback, kbflag = options.Value or options.Key, options.Callback, options.Pressed, options.Flag or (function()
2568 if flagName then
2569 return flagName .. "_ToggleKeybind"
2570 end
2571 library.unnamedkeybinds = 1 + (library.unnamedkeybinds or 0)
2572 return "Keybind" .. tostring(library.unnamedkeybinds)
2573 end)()
2574 if elements[kbflag] ~= nil or kbflag == flagName then
2575 warn(debug.traceback("Warning! Re-used flag '" .. kbflag .. "'", 3))
2576 end
2577 haskbflag = kbflag
2578 library.keyHandler = keyHandler
2579 local keyHandler = options.KeyNames or keyHandler
2580 local bindedKey = presetKeybind
2581 local justBinded = false
2582 local keyName = keyHandler.allowedKeys[bindedKey] or (bindedKey and (bindedKey.Name or tostring(bindedKey):gsub("Enum.KeyCode.", ""))) or "NONE"
2583 local newKeybind = newToggle
2584 keybindPositioner.Name = "keybindPositioner"
2585 keybindPositioner.Parent = newKeybind
2586 keybindPositioner.BackgroundColor3 = Color3.new(1, 1, 1)
2587 keybindPositioner.BackgroundTransparency = 1
2588 keybindPositioner.Position = UDim2.new(0.00448430516)
2589 keybindPositioner.Size = UDim2.fromOffset(214, 19)
2590 keybindPositioner.ZIndex = 1 + toggleButton.ZIndex
2591 keybindList.Name = "keybindList"
2592 keybindList.Parent = keybindPositioner
2593 keybindList.FillDirection = Enum.FillDirection.Horizontal
2594 keybindList.HorizontalAlignment = Enum.HorizontalAlignment.Right
2595 keybindList.SortOrder = Enum.SortOrder.LayoutOrder
2596 keybindList.VerticalAlignment = Enum.VerticalAlignment.Center
2597 keybindButton.Name = "keybindButton"
2598 keybindButton.Parent = keybindPositioner
2599 keybindButton.Active = false
2600 keybindButton.BackgroundColor3 = Color3.new(1, 1, 1)
2601 keybindButton.BackgroundTransparency = 1
2602 keybindButton.Position = UDim2.fromScale(0.598130822, 0.184210524)
2603 keybindButton.Selectable = false
2604 keybindButton.Size = UDim2.fromOffset(46, 12)
2605 keybindButton.Font = Enum.Font.Code
2606 keybindButton.Text = keyName or (presetKeybind and tostring(presetKeybind):gsub("Enum.KeyCode.", "")) or "[NONE]"
2607 keybindButton.TextColor3 = library.colors.otherElementText
2608 local colored_keybindButton_TextColor3 = {keybindButton, "TextColor3", "otherElementText"}
2609 colored[1 + #colored] = colored_keybindButton_TextColor3
2610 keybindButton.TextSize = 14
2611 keybindButton.TextXAlignment = Enum.TextXAlignment.Right
2612 keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
2613 local klast_v = bindedKey or presetKeybind
2614 local function newkey()
2615 if lockedup then
2616 return
2617 end
2618 local old_texts = keybindButton.Text
2619 colored_keybindButton_TextColor3[3] = "main"
2620 colored_keybindButton_TextColor3[4] = nil
2621 tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
2622 TextColor3 = library.colors.main
2623 }):Play()
2624 if klast_v then
2625 keybindButton.Text = "(Was " .. (klast_v and tostring(klast_v):gsub("Enum.KeyCode.", "") or "[NONE]") .. ") [...]"
2626 else
2627 keybindButton.Text = "[...]"
2628 end
2629 local receivingKey = nil
2630 receivingKey = userInputService.InputBegan:Connect(function(key)
2631 if lockedup then
2632 return receivingKey:Disconnect()
2633 end
2634 klast_v = library_flags[kbflag]
2635 if not keyHandler.notAllowedKeys[key.KeyCode] then
2636 if key.KeyCode ~= Enum.KeyCode.Unknown then
2637 bindedKey = (key.KeyCode ~= Enum.KeyCode.Escape and key.KeyCode) or library_flags[kbflag]
2638 library_flags[kbflag] = bindedKey
2639 if options.Location then
2640 options.Location[options.LocationFlag or kbflag] = bindedKey
2641 end
2642 if bindedKey then
2643 keyName = keyHandler.allowedKeys[bindedKey] or (bindedKey and (bindedKey.Name or tostring(bindedKey):gsub("Enum.KeyCode.", ""))) or "NONE"
2644 keybindButton.Text = "[" .. (keyName or (bindedKey and bindedKey.Name) or "NONE") .. "]"
2645 keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
2646 justBinded = true
2647 colored_keybindButton_TextColor3[3] = "otherElementText"
2648 colored_keybindButton_TextColor3[4] = nil
2649 tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
2650 TextColor3 = library.colors.otherElementText
2651 }):Play()
2652 receivingKey:Disconnect()
2653 end
2654 if callback and klast_v ~= bindedKey then
2655 task.spawn(callback, bindedKey, klast_v)
2656 end
2657 return
2658 elseif key.KeyCode == Enum.KeyCode.Unknown and not keyHandler.notAllowedMouseInputs[key.UserInputType] then
2659 bindedKey = key.UserInputType
2660 library_flags[kbflag] = bindedKey
2661 if options.Location then
2662 options.Location[options.LocationFlag or kbflag] = bindedKey
2663 end
2664 keyName = keyHandler.allowedKeys[bindedKey]
2665 keybindButton.Text = "[" .. (keyName or (bindedKey and bindedKey.Name) or tostring(bindedKey.KeyCode):gsub("Enum.KeyCode.", "")) .. "]"
2666 keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
2667 justBinded = true
2668 colored_keybindButton_TextColor3[3] = "otherElementText"
2669 colored_keybindButton_TextColor3[4] = nil
2670 tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
2671 TextColor3 = library.colors.otherElementText
2672 }):Play()
2673 receivingKey:Disconnect()
2674 if callback and klast_v ~= bindedKey then
2675 task.spawn(callback, bindedKey, klast_v)
2676 end
2677 return
2678 end
2679 end
2680 if key.KeyCode == Enum.KeyCode.Backspace or Enum.KeyCode.Escape == key.KeyCode then
2681 old_texts, bindedKey = "[NONE]", nil
2682 end
2683 keybindButton.Text = old_texts
2684 colored_keybindButton_TextColor3[3] = "otherElementText"
2685 colored_keybindButton_TextColor3[4] = nil
2686 tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
2687 TextColor3 = library.colors.otherElementText
2688 }):Play()
2689 receivingKey:Disconnect()
2690 if callback and klast_v ~= bindedKey then
2691 task.spawn(callback, bindedKey, klast_v)
2692 end
2693 end)
2694 library.signals[1 + #library.signals] = receivingKey
2695 end
2696 library.signals[1 + #library.signals] = keybindButton.MouseButton1Click:Connect(newkey)
2697 if kbpresscallback and not justBinded then
2698 library.signals[1 + #library.signals] = userInputService.InputBegan:Connect(function(key, chatting)
2699 chatting = chatting or (userInputService:GetFocusedTextBox() and true)
2700 if not chatting and not justBinded then
2701 if not keyHandler.notAllowedKeys[key.KeyCode] and not keyHandler.notAllowedMouseInputs[key.UserInputType] then
2702 if bindedKey == key.UserInputType or not justBinded and bindedKey == key.KeyCode then
2703 if kbpresscallback then
2704 task.spawn(kbpresscallback, key, chatting)
2705 end
2706 end
2707 justBinded = false
2708 end
2709 end
2710 end)
2711 end
2712 options.Mode = (options.Mode and string.lower(tostring(options.Mode))) or "dynamic"
2713 local modes = {
2714 dynamic = 1,
2715 hold = 1,
2716 toggle = 1
2717 }
2718 library.signals[1 + #library.signals] = userInputService.InputBegan:Connect(function(input, chatting)
2719 if justBinded then
2720 wait(0.1)
2721 justBinded = false
2722 return
2723 elseif lockedup then
2724 return
2725 end
2726 chatting = chatting or userInputService:GetFocusedTextBox()
2727 if not chatting then
2728 local key = library_flags[kbflag]
2729 local mode = options.Mode
2730 if not modes[mode] then
2731 mode = "dynamic"
2732 options.Mode = mode
2733 end
2734 if key == input.KeyCode or key == input.UserInputType then
2735 if mode == "dynamic" or mode == "both" or mode == "hold" then
2736 if mode == "dynamic" and library_flags[flagName] then
2737 return Set(false)
2738 end
2739 Set(true)
2740 local now = os.clock()
2741 local waittil = nil
2742 if mode == "dynamic" then
2743 waittil = Instance.new("BindableEvent")
2744 end
2745 local xconnection = nil
2746 xconnection = userInputService.InputEnded:Connect(function(input, chatting)
2747 chatting = chatting or userInputService:GetFocusedTextBox()
2748 if not chatting and (key == input.KeyCode or key == input.UserInputType) then
2749 xconnection = (xconnection and xconnection:Disconnect() and nil) or nil
2750 if mode == "hold" or os.clock() - now > math.clamp(tonumber(options.DynamicTime) or 0.65, 0.05, 20) then
2751 Set(false)
2752 end
2753 end
2754 end)
2755 library.signals[1 + #library.signals] = xconnection
2756 else
2757 Set(not library_flags[flagName])
2758 end
2759 end
2760 end
2761 end)
2762 local function kbset(t, key)
2763 if nil == key and t ~= nil then
2764 key = t
2765 end
2766 if key == "nil" or key == "NONE" or key == "none" then
2767 key = nil
2768 end
2769 last_v = library_flags[kbflag]
2770 bindedKey = key
2771 library_flags[kbflag] = key
2772 if options.Location then
2773 options.Location[options.LocationFlag or kbflag] = key
2774 end
2775 keyName = (key == nil and "NONE") or keyHandler.allowedKeys[key]
2776 keybindButton.Text = "[" .. (keyName or key.Name or tostring(key):gsub("Enum.KeyCode.", "")) .. "]"
2777 keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
2778 justBinded = true
2779 colored_keybindButton_TextColor3[3] = "otherElementText"
2780 colored_keybindButton_TextColor3[4] = nil
2781 tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
2782 TextColor3 = library.colors.otherElementText
2783 }):Play()
2784 if callback and (last_v ~= key or options.AllowDuplicateCalls) then
2785 task.spawn(callback, key, last_v)
2786 end
2787 return key
2788 end
2789 if presetKeybind ~= nil then
2790 kbset(presetKeybind)
2791 else
2792 library_flags[kbflag] = bindedKey
2793 if options.Location then
2794 options.Location[options.LocationFlag or kbflag] = bindedKey
2795 end
2796 end
2797 local default = library_flags[kbflag]
2798 local function UpdateKb()
2799 callback, kbpresscallback = options.Callback, options.Pressed
2800 local key = library_flags[kbflag]
2801 bindedKey = key
2802 keyName = keyHandler.allowedKeys[bindedKey] or (bindedKey and (bindedKey.Name or tostring(bindedKey):gsub("Enum.KeyCode.", ""))) or "NONE"
2803 keybindButton.Text = "[" .. (keyName or (key and key.Name) or tostring(key):gsub("Enum.KeyCode.", "")) .. "]"
2804 keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
2805 colored_keybindButton_TextColor3[3] = "otherElementText"
2806 colored_keybindButton_TextColor3[4] = (lockedup and 2.5) or nil
2807 tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
2808 TextColor3 = (lockedup and darkenColor(library.colors.otherElementText, colored_keybindButton_TextColor3[4])) or library.colors.otherElementText
2809 }):Play()
2810 return key
2811 end
2812 kbUpdate = UpdateKb
2813 local objectdata = {
2814 Options = options,
2815 Name = kbflag,
2816 Flag = kbflag,
2817 Type = "Keybind",
2818 Default = default,
2819 Parent = sectionFunctions,
2820 Instance = keybindButton,
2821 Get = function()
2822 return library_flags[kbflag]
2823 end,
2824 Set = kbset,
2825 RawSet = function(t, key)
2826 if t ~= nil and key == nil then
2827 key = t
2828 end
2829 library_flags[kbflag] = key
2830 UpdateKb()
2831 return key
2832 end,
2833 Update = UpdateKb,
2834 Reset = function()
2835 return kbset(nil, default)
2836 end
2837 }
2838 kbData = objectdata
2839 tabFunctions.Flags[kbflag], sectionFunctions.Flags[kbflag], elements[kbflag] = objectdata, objectdata, objectdata
2840 end
2841 sectionFunctions:Update()
2842 library.signals[1 + #library.signals] = toggleButton.MouseButton1Click:Connect(function()
2843 if not library.colorpicker and not submenuOpen and not lockedup then
2844 local newval = not library_flags[flagName]
2845 if options.Condition ~= nil then
2846 if type(options.Condition) == "function" then
2847 local v, e = pcall(options.Condition, newval, not newval)
2848 if e then
2849 if not v then
2850 warn(debug.traceback(string.format("Error in toggle %s's Condition function: %s", flagName, e), 2))
2851 end
2852 else
2853 return last_v
2854 end
2855 end
2856 end
2857 library_flags[flagName] = newval
2858 if options.Location then
2859 options.Location[options.LocationFlag or flagName] = newval
2860 end
2861 colored_toggleInner_BackgroundColor3[3] = (newval and "main") or "topGradient"
2862 colored_toggleInner_BackgroundColor3[4] = (newval and 1.5) or nil
2863 colored_toggleInner_ImageColor3[3] = (newval and "main") or "bottomGradient"
2864 colored_toggleInner_ImageColor3[4] = (newval and 2.5) or nil
2865 tweenService:Create(toggleInner, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
2866 BackgroundColor3 = (newval and darkenColor(library.colors.main, 1.5)) or library.colors.topGradient,
2867 ImageColor3 = (newval and darkenColor(library.colors.main, 2.5)) or library.colors.bottomGradient
2868 }):Play()
2869 if callback then
2870 task.spawn(callback, newval)
2871 end
2872 end
2873 end)
2874 library.signals[1 + #library.signals] = newToggle.MouseEnter:Connect(function()
2875 colored_toggle_BackgroundColor3[3] = "main"
2876 colored_toggle_BackgroundColor3[4] = 1.5
2877 colored_toggle_ImageColor3[3] = "main"
2878 colored_toggle_ImageColor3[4] = 2.5
2879 tweenService:Create(toggle, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
2880 BackgroundColor3 = darkenColor(library.colors.main, 1.5),
2881 ImageColor3 = darkenColor(library.colors.main, 2.5)
2882 }):Play()
2883 end)
2884 library.signals[1 + #library.signals] = newToggle.MouseLeave:Connect(function()
2885 colored_toggle_BackgroundColor3[3] = "topGradient"
2886 colored_toggle_BackgroundColor3[4] = nil
2887 colored_toggle_ImageColor3[3] = "bottomGradient"
2888 colored_toggle_ImageColor3[4] = nil
2889 tweenService:Create(toggle, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
2890 BackgroundColor3 = library.colors.topGradient,
2891 ImageColor3 = library.colors.bottomGradient
2892 }):Play()
2893 end)
2894 if library_flags[flagName] then
2895 colored_toggleInner_BackgroundColor3[3] = "main"
2896 colored_toggleInner_BackgroundColor3[4] = 1.5
2897 colored_toggleInner_ImageColor3[3] = "main"
2898 colored_toggleInner_ImageColor3[4] = 2.5
2899 tweenService:Create(toggleInner, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
2900 BackgroundColor3 = darkenColor(library.colors.main, 1.5),
2901 ImageColor3 = darkenColor(library.colors.main, 2.5)
2902 }):Play()
2903 end
2904 local function Update()
2905 toggleName, callback = options.Name or toggleName, options.Callback
2906 local boolstatus = library_flags[flagName]
2907 colored_toggleInner_BackgroundColor3[3] = (boolstatus and "main") or "topGradient"
2908 colored_toggleInner_BackgroundColor3[4] = (boolstatus and 1.5) or nil
2909 colored_toggleInner_ImageColor3[3] = (boolstatus and "main") or "bottomGradient"
2910 colored_toggleInner_ImageColor3[4] = (boolstatus and 2.5) or nil
2911 if lockedup then
2912 colored_toggleInner_BackgroundColor3[4] = 1 + (colored_toggleInner_BackgroundColor3[4] or 1)
2913 colored_toggleInner_ImageColor3[4] = 1 + (colored_toggleInner_ImageColor3[4] or 1)
2914 end
2915 tweenService:Create(toggleInner, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
2916 BackgroundColor3 = (boolstatus and darkenColor(library.colors.main, colored_toggleInner_BackgroundColor3[4])) or library.colors.topGradient,
2917 ImageColor3 = (boolstatus and darkenColor(library.colors.main, colored_toggleInner_ImageColor3[4])) or library.colors.bottomGradient
2918 }):Play()
2919 colored_toggleHeadline_TextColor3[4] = (lockedup and 2.5) or nil
2920 tweenService:Create(toggleHeadline, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
2921 TextColor3 = (lockedup and darkenColor(library.colors.elementText, colored_toggleHeadline_TextColor3[4])) or library.colors.elementText
2922 }):Play()
2923 toggleHeadline.Text = toggleName or "???"
2924 return boolstatus
2925 end
2926 if alreadyEnabled ~= nil then
2927 Set(alreadyEnabled)
2928 else
2929 library_flags[flagName] = alreadyEnabled and true
2930 if options.Location then
2931 options.Location[options.LocationFlag or flagName] = alreadyEnabled and true
2932 end
2933 end
2934 local default = library_flags[flagName] and true
2935 Update()
2936 if kbUpdate then
2937 kbUpdate()
2938 end
2939 local objectdata = {
2940 Options = options,
2941 Type = "Toggle",
2942 Name = flagName,
2943 Flag = flagName,
2944 Default = default,
2945 Parent = sectionFunctions,
2946 Instance = toggleButton,
2947 Set = Set,
2948 Remove = function()
2949 if newToggle then
2950 newToggle.Parent = nil
2951 sectionFunctions:Update()
2952 end
2953 end,
2954 RawSet = function(t, newStatus, condition)
2955 if t ~= nil and type(t) ~= "table" then
2956 newStatus, condition = t, newStatus
2957 end
2958 last_v = library_flags[flagName]
2959 if (condition ~= false) and (condition ~= 0) then
2960 local overridecondition = condition and (type(condition) == "function") and condition
2961 if overridecondition or (options.Condition ~= nil) then
2962 if type(overridecondition or options.Condition) == "function" then
2963 local v, e = pcall(overridecondition or options.Condition, newStatus, last_v)
2964 if e then
2965 if not v then
2966 warn(debug.traceback(string.format("Error in toggle (RawSet) %s's Condition function: %s", flagName, e), 2))
2967 end
2968 else
2969 return last_v
2970 end
2971 end
2972 end
2973 end
2974 library_flags[flagName] = newStatus
2975 if options.Location then
2976 options.Location[options.LocationFlag or flagName] = newStatus
2977 end
2978 Update()
2979 return newStatus
2980 end,
2981 KeybindData = kbData,
2982 Get = function()
2983 return library_flags[flagName]
2984 end,
2985 Update = Update,
2986 Reset = function()
2987 return Set(nil, default)
2988 end,
2989 SetLocked = function(t, state)
2990 if type(t) ~= "table" then
2991 state = t
2992 end
2993 local last_v = lockedup
2994 if state == nil then
2995 lockedup = not lockedup
2996 else
2997 lockedup = state
2998 end
2999 if lockedup ~= last_v then
3000 colored_toggleHeadline_TextColor3[4] = (lockedup and 2.5) or nil
3001 Update()
3002 if kbUpdate then
3003 kbUpdate()
3004 end
3005 end
3006 return lockedup
3007 end,
3008 Lock = function()
3009 if not lockedup then
3010 lockedup = true
3011 colored_toggleHeadline_TextColor3[4] = 2.5
3012 Update()
3013 if kbUpdate then
3014 kbUpdate()
3015 end
3016 end
3017 return lockedup
3018 end,
3019 Unlock = function()
3020 if lockedup then
3021 lockedup = false
3022 colored_toggleHeadline_TextColor3[4] = nil
3023 Update()
3024 if kbUpdate then
3025 kbUpdate()
3026 end
3027 end
3028 return lockedup
3029 end,
3030 SetCondition = function(t, condition)
3031 if type(t) ~= "table" and condition == nil then
3032 condition = t
3033 end
3034 options.Condition = condition
3035 return condition
3036 end
3037 }
3038 if kbData then
3039 kbData.ToggleData = objectdata
3040 end
3041 tabFunctions.Flags[flagName], sectionFunctions.Flags[flagName], elements[flagName] = objectdata, objectdata, objectdata
3042 return objectdata
3043 end
3044 sectionFunctions.CreateToggle = sectionFunctions.AddToggle
3045 sectionFunctions.NewToggle = sectionFunctions.AddToggle
3046 sectionFunctions.Toggle = sectionFunctions.AddToggle
3047 sectionFunctions.Tog = sectionFunctions.AddToggle
3048 function sectionFunctions:AddButton(...)
3049 local args = nil
3050 if ... and not select(2, ...) and type(...) == "table" and #... > 0 and type((...)[1]) == "table" and (...)[1].Name then
3051 args = ...
3052 else
3053 args = {...}
3054 end
3055 local buttons, offset = {}, 0
3056 local frames = {}
3057 local fram = nil
3058 for _, options in next, args do
3059 options = (options and options[1] and type(options[1]) == "string" and resolvevararg("Button", unpack(options))) or options
3060 local buttonName, callback = assert(options.Name, "Missing Name for new button."), options.Callback or (warn("AddButton missing callback. Name:", options.Name or "No Name", debug.traceback("")) and nil) or function()
3061 end
3062 local lockedup = options.Locked
3063 local realButton = Instance_new("TextButton")
3064 realButton.Name = "realButton"
3065 realButton.BackgroundColor3 = Color3.new(1, 1, 1)
3066 realButton.BackgroundTransparency = 1
3067 realButton.Size = UDim2.fromScale(1, 1)
3068 realButton.ZIndex = 5
3069 realButton.Font = Enum.Font.Code
3070 realButton.Text = (buttonName and tostring(buttonName)) or "???"
3071 realButton.TextColor3 = library.colors.elementText
3072 local colored_realButton_TextColor3 = {realButton, "TextColor3", "elementText"}
3073 colored[1 + #colored] = colored_realButton_TextColor3
3074 realButton.TextSize = 14
3075 local textsize = textToSize(realButton).X + 14
3076 if newSection.Parent and (newSection.Parent.AbsoluteSize.X < (offset + textsize + 8)) then
3077 offset, fram = 0, nil
3078 end
3079 local newButton = fram or Instance_new("Frame")
3080 fram = newButton
3081 local framButtons = frames[fram] or {}
3082 frames[fram] = framButtons
3083 local button = Instance_new("ImageLabel")
3084 newButton.Name = removeSpaces((buttonName and buttonName:lower() or "???") .. "Holder")
3085 newButton.Parent = sectionHolder
3086 newButton.BackgroundColor3 = Color3.new(1, 1, 1)
3087 newButton.BackgroundTransparency = 1
3088 newButton.Size = UDim2.new(1, 0, 0, 24)
3089 button.Name = "button"
3090 button.Parent = newButton
3091 button.Active = true
3092 button.BackgroundColor3 = library.colors.topGradient
3093 local colored_button_BackgroundColor3 = {button, "BackgroundColor3", "topGradient"}
3094 colored[1 + #colored] = colored_button_BackgroundColor3
3095 button.BorderColor3 = library.colors.elementBorder
3096 colored[1 + #colored] = {button, "BorderColor3", "elementBorder"}
3097 button.Position = UDim2.new(0.031, offset, 0.166)
3098 button.Selectable = true
3099 button.Size = UDim2.fromOffset(28, 18)
3100 button.Image = "rbxassetid://2454009026"
3101 button.ImageColor3 = library.colors.bottomGradient
3102 local colored_button_ImageColor3 = {button, "ImageColor3", "bottomGradient"}
3103 colored[1 + #colored] = colored_button_ImageColor3
3104 local buttonInner = Instance_new("ImageLabel")
3105 buttonInner.Name = "buttonInner"
3106 buttonInner.Parent = button
3107 buttonInner.Active = true
3108 buttonInner.AnchorPoint = Vector2.new(0.5, 0.5)
3109 buttonInner.BackgroundColor3 = library.colors.topGradient
3110 local colored_buttonInner_BackgroundColor3 = {buttonInner, "BackgroundColor3", "topGradient"}
3111 colored[1 + #colored] = colored_buttonInner_BackgroundColor3
3112 buttonInner.BorderColor3 = library.colors.elementBorder
3113 colored[1 + #colored] = {buttonInner, "BorderColor3", "elementBorder"}
3114 buttonInner.Position = UDim2.fromScale(0.5, 0.5)
3115 buttonInner.Selectable = true
3116 buttonInner.Size = UDim2.new(1, -4, 1, -4)
3117 buttonInner.Image = "rbxassetid://2454009026"
3118 buttonInner.ImageColor3 = library.colors.bottomGradient
3119 local colored_buttonInner_ImageColor3 = {buttonInner, "ImageColor3", "bottomGradient"}
3120 colored[1 + #colored] = colored_buttonInner_ImageColor3
3121 button.Size = UDim2.fromOffset(textsize, 18)
3122 realButton.Parent = button
3123 offset = offset + textsize + 6
3124 sectionFunctions:Update()
3125 local presses = 0
3126 library.signals[1 + #library.signals] = realButton.MouseButton1Click:Connect(function()
3127 if lockedup then
3128 return
3129 end
3130 if options.Condition ~= nil and type(options.Condition) == "function" then
3131 local v, e = pcall(options.Condition, presses)
3132 if e then
3133 if not v then
3134 warn(debug.traceback(string.format("Error in button %s's Condition function: %s", buttonName, e), 2))
3135 end
3136 else
3137 return
3138 end
3139 end
3140 if not library.colorpicker and not submenuOpen then
3141 presses = 1 + presses
3142 task.spawn(callback, presses)
3143 end
3144 end)
3145 local imin = nil
3146 library.signals[1 + #library.signals] = button.MouseEnter:Connect(function()
3147 imin = 1
3148 colored_button_BackgroundColor3[3] = "main"
3149 colored_button_BackgroundColor3[4] = 1.5
3150 colored_button_ImageColor3[3] = "main"
3151 colored_button_ImageColor3[4] = 2.5
3152 tweenService:Create(button, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
3153 BackgroundColor3 = darkenColor(library.colors.main, 1.5),
3154 ImageColor3 = darkenColor(library.colors.main, 2.5)
3155 }):Play()
3156 end)
3157 library.signals[1 + #library.signals] = button.MouseLeave:Connect(function()
3158 imin = nil
3159 colored_button_BackgroundColor3[3] = "topGradient"
3160 colored_button_BackgroundColor3[4] = nil
3161 colored_button_ImageColor3[3] = "bottomGradient"
3162 colored_button_ImageColor3[4] = nil
3163 tweenService:Create(button, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
3164 BackgroundColor3 = library.colors.topGradient,
3165 ImageColor3 = library.colors.bottomGradient
3166 }):Play()
3167 end)
3168 local function Update(Recursive)
3169 buttonName, callback = options.Name or buttonName, options.Callback or (warn(debug.traceback("AddButton missing callback. Name:" .. (options.Name or buttonName or "No Name"), 2)) and nil) or function()
3170 end
3171 colored_button_BackgroundColor3[3] = (imin and "main") or "topGradient"
3172 colored_button_BackgroundColor3[4] = (imin and 1.5) or nil
3173 colored_button_ImageColor3[3] = (imin and "main") or "bottomGradient"
3174 colored_button_ImageColor3[4] = (imin and 2.5) or nil
3175 colored_buttonInner_BackgroundColor3[4] = nil
3176 colored_buttonInner_ImageColor3[4] = nil
3177 colored_realButton_TextColor3[4] = nil
3178 if lockedup then
3179 colored_button_BackgroundColor3[4] = 1.25
3180 colored_button_ImageColor3[4] = 1.25
3181 colored_buttonInner_BackgroundColor3[4] = 1.25
3182 colored_buttonInner_ImageColor3[4] = 1.25
3183 colored_realButton_TextColor3[4] = 1.75
3184 end
3185 tweenService:Create(button, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
3186 BackgroundColor3 = (imin and darkenColor(library.colors.main, colored_button_BackgroundColor3[4])) or darkenColor(library.colors.topGradient, colored_button_BackgroundColor3[4]),
3187 ImageColor3 = (imin and darkenColor(library.colors.main, colored_button_ImageColor3[4])) or darkenColor(library.colors.bottomGradient, colored_button_ImageColor3[4])
3188 }):Play()
3189 tweenService:Create(buttonInner, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
3190 BackgroundColor3 = darkenColor(library.colors.topGradient, colored_buttonInner_BackgroundColor3[4]),
3191 ImageColor3 = darkenColor(library.colors.bottomGradient, colored_buttonInner_ImageColor3[4])
3192 }):Play()
3193 tweenService:Create(realButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
3194 TextColor3 = darkenColor(library.colors.elementText, colored_realButton_TextColor3[4])
3195 }):Play()
3196 realButton.Text = (buttonName and tostring(buttonName)) or "???"
3197 local newtextsize = textToSize(realButton).X + 14
3198 if textsize ~= newtextsize then
3199 textsize = newtextsize
3200 button.Size = UDim2.fromOffset(textsize, 18)
3201 if Recursive ~= "Recursive" then
3202 if buttons and buttons.UpdateAll then
3203 buttons.UpdateAll()
3204 end
3205 end
3206 end
3207 return presses, textsize
3208 end
3209 Update()
3210 local objectdata = {
3211 Options = options,
3212 Name = buttonName,
3213 Flag = buttonName,
3214 Type = "Button",
3215 Parent = sectionFunctions,
3216 Instance = realButton,
3217 Frame = fram or newButton,
3218 ButtonFrame = button,
3219 Remove = function()
3220 if button then
3221 button.Parent = nil
3222 buttons.UpdateAll()
3223 sectionFunctions.UpdateAll()
3224 end
3225 end,
3226 Press = function(...)
3227 if lockedup then
3228 return presses
3229 end
3230 if options.Condition ~= nil and type(options.Condition) == "function" then
3231 local v, e = pcall(options.Condition, presses)
3232 if e then
3233 if v then
3234 else
3235 warn(debug.traceback(string.format("Error in button %s's Condition function: %s", buttonName, e), 2))
3236 end
3237 else
3238 return presses
3239 end
3240 end
3241 local args = {...}
3242 local a1 = args[1]
3243 if a1 and type(a1) == "table" then
3244 table.remove(args, 1)
3245 end
3246 presses = 1 + presses
3247 task.spawn(callback, presses, ...)
3248 return presses
3249 end,
3250 RawPress = function(...)
3251 local args = {...}
3252 local a1 = args[1]
3253 if a1 and type(a1) == "table" then
3254 table.remove(args, 1)
3255 end
3256 task.spawn(callback, presses, ...)
3257 return presses
3258 end,
3259 Get = function()
3260 return callback, presses
3261 end,
3262 SetLocked = function(t, state)
3263 if type(t) ~= "table" then
3264 state = t
3265 end
3266 local last_v = lockedup
3267 if state == nil then
3268 lockedup = not lockedup
3269 else
3270 lockedup = state
3271 end
3272 if lockedup ~= last_v then
3273 Update()
3274 end
3275 return lockedup
3276 end,
3277 Lock = function()
3278 if not lockedup then
3279 lockedup = true
3280 Update()
3281 end
3282 return lockedup
3283 end,
3284 Unlock = function()
3285 if lockedup then
3286 lockedup = false
3287 Update()
3288 end
3289 return lockedup
3290 end,
3291 SetCondition = function(t, condition)
3292 if type(t) ~= "table" and condition == nil then
3293 condition = t
3294 end
3295 options.Condition = condition
3296 return condition
3297 end,
3298 Update = Update,
3299 SetText = function(t, str)
3300 if type(t) ~= "table" and str == nil then
3301 str = t
3302 end
3303 buttonName = str
3304 options.Name = str
3305 realButton.Text = (buttonName and tostring(buttonName)) or "???"
3306 return str
3307 end,
3308 SetCallback = function(t, call)
3309 if type(t) ~= "table" and call == nil then
3310 call = t
3311 end
3312 options.Callback = call
3313 callback = call
3314 return call
3315 end
3316 }
3317 tabFunctions.Flags[buttonName], sectionFunctions.Flags[buttonName], elements[buttonName] = objectdata, objectdata, objectdata
3318 buttons[1 + #buttons] = objectdata
3319 framButtons[1 + #framButtons] = objectdata
3320 end
3321 function buttons.PressAll()
3322 for _, v in next, buttons do
3323 v.Press()
3324 end
3325 end
3326 function buttons.UpdateAll()
3327 for fram, Fram in next, frames do
3328 if Fram and fram then
3329 local offset = 0
3330 for _, v in next, Fram do
3331 if v and v.Instance and fram:IsAncestorOf(v.Instance) then
3332 local _, textsize = v.Update("Recursive")
3333 textsize = tonumber(textsize) or (textToSize(v.Instance).X + 14)
3334 v.ButtonFrame.Position = UDim2.new(0.031, offset, 0.166)
3335 offset = offset + textsize + 6
3336 end
3337 end
3338 end
3339 end
3340 end
3341 buttons.Update = buttons.UpdateAll
3342 function buttons.RemoveAll()
3343 for _, v in next, buttons do
3344 v.Remove()
3345 end
3346 end
3347 function buttons.Remove()
3348 for fram in next, frames do
3349 if fram then
3350 fram.Parent = nil
3351 end
3352 end
3353 end
3354 if #buttons == 1 then
3355 for k, v in next, buttons[1] do
3356 if buttons[k] == nil then
3357 buttons[k] = v
3358 end
3359 end
3360 end
3361 return buttons
3362 end
3363 sectionFunctions.CreateButton = sectionFunctions.AddButton
3364 sectionFunctions.NewButton = sectionFunctions.AddButton
3365 sectionFunctions.Button = sectionFunctions.AddButton
3366 function sectionFunctions:AddTextbox(options, ...)
3367 options = (options and type(options) == "string" and resolvevararg("Textbox", options, ...)) or options
3368 local textboxName, presetValue, placeholder, callback, flagName = assert(options.Name, "Missing Name for new textbox."), options.Value, options.Placeholder, options.Callback, options.Flag or (function()
3369 library.unnamedtextboxes = 1 + (library.unnamedtextboxes or 0)
3370 return "Textbox" .. tostring(library.unnamedtextboxes)
3371 end)()
3372 if elements[flagName] ~= nil then
3373 warn(debug.traceback("Warning! Re-used flag '" .. flagName .. "'", 3))
3374 end
3375 local requiredtype = options.Type
3376 local newTextbox = Instance_new("Frame")
3377 local textbox = Instance_new("ImageLabel")
3378 local textboxInner = Instance_new("ImageLabel")
3379 local realTextbox = Instance_new("TextBox")
3380 local textboxHeadline = Instance_new("TextLabel")
3381 newTextbox.Name = removeSpaces((textboxName and textboxName:lower()) or "???") .. "Holder"
3382 newTextbox.Parent = sectionHolder
3383 newTextbox.BackgroundColor3 = Color3.new(1, 1, 1)
3384 newTextbox.BackgroundTransparency = 1
3385 newTextbox.Size = UDim2.new(1, 0, 0, 42)
3386 textbox.Name = "textbox"
3387 textbox.Parent = newTextbox
3388 textbox.Active = true
3389 textbox.BackgroundColor3 = library.colors.topGradient
3390 local colored_textbox_BackgroundColor3 = {textbox, "BackgroundColor3", "topGradient"}
3391 colored[1 + #colored] = colored_textbox_BackgroundColor3
3392 textbox.BorderColor3 = library.colors.elementBorder
3393 colored[1 + #colored] = {textbox, "BorderColor3", "elementBorder"}
3394 textbox.Position = UDim2.fromScale(0.031, 0.48)
3395 textbox.Selectable = true
3396 textbox.Size = UDim2.fromOffset(206, 18)
3397 textbox.Image = "rbxassetid://2454009026"
3398 textbox.ImageColor3 = library.colors.bottomGradient
3399 local colored_textbox_ImageColor3 = {textbox, "ImageColor3", "bottomGradient"}
3400 colored[1 + #colored] = colored_textbox_ImageColor3
3401 textboxInner.Name = "textboxInner"
3402 textboxInner.Parent = textbox
3403 textboxInner.Active = true
3404 textboxInner.AnchorPoint = Vector2.new(0.5, 0.5)
3405 textboxInner.BackgroundColor3 = library.colors.topGradient
3406 colored[1 + #colored] = {textboxInner, "BackgroundColor3", "topGradient"}
3407 textboxInner.BorderColor3 = library.colors.elementBorder
3408 colored[1 + #colored] = {textboxInner, "BorderColor3", "elementBorder"}
3409 textboxInner.Position = UDim2.fromScale(0.5, 0.5)
3410 textboxInner.Selectable = true
3411 textboxInner.Size = UDim2.new(1, -4, 1, -4)
3412 textboxInner.Image = "rbxassetid://2454009026"
3413 textboxInner.ImageColor3 = library.colors.bottomGradient
3414 colored[1 + #colored] = {textboxInner, "ImageColor3", "bottomGradient"}
3415 realTextbox.Name = "realTextbox"
3416 if options.Rich or options.RichText or options.RichTextBox then
3417 realTextbox.RichText = true
3418 end
3419 if options.MultiLine or options.Lines then
3420 realTextbox.MultiLine = true
3421 end
3422 if options.Font or options.TextFont then
3423 realTextbox.Font = options.Font
3424 end
3425 if options.TextScaled or options.Scaled then
3426 realTextbox.TextScaled = true
3427 end
3428 realTextbox.BackgroundColor3 = Color3.new(1, 1, 1)
3429 realTextbox.BackgroundTransparency = 1
3430 realTextbox.Position = UDim2.new(0.0295485705)
3431 realTextbox.Size = UDim2.fromScale(0.97, 1)
3432 realTextbox.ZIndex = 5
3433 realTextbox.Font = Enum.Font.Code
3434 realTextbox.LineHeight = 1.15
3435 realTextbox.Text = tostring(presetValue)
3436 realTextbox.TextColor3 = library.colors.otherElementText
3437 colored[1 + #colored] = {realTextbox, "TextColor3", "otherElementText"}
3438 realTextbox.TextSize = 14
3439 if options.ClearTextOnFocus or options.ClearText then
3440 realTextbox.ClearTextOnFocus = true
3441 else
3442 realTextbox.ClearTextOnFocus = false
3443 end
3444 realTextbox.PlaceholderText = (placeholder ~= nil and tostring(placeholder)) or (presetValue ~= nil and tostring(presetValue)) or ""
3445 realTextbox.TextXAlignment = Enum.TextXAlignment.Left
3446 if options.CustomProperties and type(options.CustomProperties) == "table" then
3447 for k, v in next, options.CustomProperties do
3448 local oof, e = pcall(function()
3449 realTextbox[k] = v
3450 end)
3451 if not oof and e then
3452 warn("Error setting Textbox", flagName, "|", e, debug.traceback(""))
3453 end
3454 end
3455 end
3456 realTextbox.Parent = textbox
3457 textboxHeadline.Name = "textboxHeadline"
3458 textboxHeadline.Parent = newTextbox
3459 textboxHeadline.Active = true
3460 textboxHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
3461 textboxHeadline.BackgroundTransparency = 1
3462 textboxHeadline.Position = UDim2.new(0.031)
3463 textboxHeadline.Selectable = true
3464 textboxHeadline.Size = UDim2.fromOffset(206, 20)
3465 textboxHeadline.ZIndex = 5
3466 textboxHeadline.Font = Enum.Font.Code
3467 textboxHeadline.LineHeight = 1.15
3468 textboxHeadline.Text = (textboxName and tostring(textboxName)) or "???"
3469 textboxHeadline.TextColor3 = library.colors.elementText
3470 colored[1 + #colored] = {textboxHeadline, "TextColor3", "elementText"}
3471 textboxHeadline.TextSize = 14
3472 textboxHeadline.TextXAlignment = Enum.TextXAlignment.Left
3473 sectionFunctions:Update()
3474 local last_v = presetValue
3475 local function resolvevalue(val)
3476 if options.PreFormat then
3477 local typ = type(options.PreFormat)
3478 if typ == "function" then
3479 local x, e = pcall(options.PreFormat, val)
3480 if not x and e then
3481 warn("Error in Pre-Format (Textbox " .. flagName .. "):", e)
3482 else
3483 val = e
3484 end
3485 end
3486 end
3487 if requiredtype == "number" then
3488 if not options.Hex and not options.Binary and not options.Base then
3489 val = tonumber(val) or tonumber(val:gsub("%D", ""), 10) or 0
3490 else
3491 val = tonumber(val, (options.Hex and 16) or (options.Binary and 2) or options.Base or 10) or 0
3492 end
3493 if options.Max or options.Min then
3494 val = math.clamp(val, options.Min or -math.huge, options.Max or math.huge)
3495 end
3496 local decimalprecision = tonumber(options.Decimals or options.Precision or options.Precise)
3497 if decimalprecision then
3498 val = tonumber(string.format("%0." .. tostring(decimalprecision) .. "f", val))
3499 end
3500 end
3501 if options.PostFormat then
3502 local typ = type(options.PostFormat)
3503 if typ == "function" then
3504 local x, e = pcall(options.PostFormat, val)
3505 if not x and e then
3506 warn("Error in Post-Format (Textbox " .. flagName .. "):", e)
3507 else
3508 val = e
3509 end
3510 end
3511 end
3512 return (val and tonumber(val)) or val
3513 end
3514 library.signals[1 + #library.signals] = realTextbox.FocusLost:Connect(function()
3515 last_v = library_flags[flagName]
3516 local val = resolvevalue(realTextbox.Text)
3517 library_flags[flagName] = val
3518 if options.Location then
3519 options.Location[options.LocationFlag or flagName] = val
3520 end
3521 if callback and last_v ~= val then
3522 task.spawn(callback, tostring(val), last_v, realTextbox)
3523 end
3524 end)
3525 library.signals[1 + #library.signals] = newTextbox.MouseEnter:Connect(function()
3526 colored_textbox_BackgroundColor3[3] = "main"
3527 colored_textbox_BackgroundColor3[4] = 1.5
3528 colored_textbox_ImageColor3[3] = "main"
3529 colored_textbox_ImageColor3[4] = 2.5
3530 tweenService:Create(textbox, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
3531 BackgroundColor3 = darkenColor(library.colors.main, 1.5),
3532 ImageColor3 = darkenColor(library.colors.main, 2.5)
3533 }):Play()
3534 end)
3535 library.signals[1 + #library.signals] = newTextbox.MouseLeave:Connect(function()
3536 colored_textbox_BackgroundColor3[3] = "topGradient"
3537 colored_textbox_BackgroundColor3[4] = nil
3538 colored_textbox_ImageColor3[3] = "bottomGradient"
3539 colored_textbox_ImageColor3[4] = nil
3540 tweenService:Create(textbox, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
3541 BackgroundColor3 = library.colors.topGradient,
3542 ImageColor3 = library.colors.bottomGradient
3543 }):Play()
3544 end)
3545 local function set(t, str)
3546 if nil == str and t ~= nil then
3547 str = t
3548 end
3549 last_v = library_flags[flagName]
3550 library_flags[flagName] = str
3551 if options.Location then
3552 options.Location[options.LocationFlag or flagName] = str
3553 end
3554 local sstr = (str ~= nil and tostring(str)) or "Empty Text"
3555 if realTextbox.Text ~= sstr then
3556 realTextbox.Text = sstr
3557 end
3558 if callback and (last_v ~= str or options.AllowDuplicateCalls) then
3559 task.spawn(callback, str, last_v, realTextbox)
3560 end
3561 return str
3562 end
3563 if presetValue ~= nil then
3564 set(presetValue)
3565 else
3566 library_flags[flagName] = presetValue
3567 if options.Location then
3568 options.Location[options.LocationFlag or flagName] = presetValue
3569 end
3570 end
3571 local default = library_flags[flagName]
3572 local function update()
3573 textboxName, placeholder, callback = options.Name or textboxName, options.Placeholder or placeholder, options.Callback
3574 local str = library_flags[flagName]
3575 str = (str ~= nil and tostring(str)) or "Empty Text"
3576 if realTextbox.Text ~= str then
3577 realTextbox.Text = str
3578 end
3579 textboxHeadline.Text = (textboxName and tostring(textboxName)) or "???"
3580 return str
3581 end
3582 local objectdata = {
3583 Options = options,
3584 Name = flagName,
3585 Flag = flagName,
3586 Type = "Textbox",
3587 Default = default,
3588 Parent = sectionFunctions,
3589 Instance = realTextbox,
3590 Get = function()
3591 return library_flags[flagName]
3592 end,
3593 Set = set,
3594 Update = update,
3595 Remove = function()
3596 if newTextbox then
3597 newTextbox.Parent = nil
3598 sectionFunctions:Update()
3599 end
3600 end,
3601 RawSet = function(t, str)
3602 if t ~= nil and str == nil then
3603 str = t
3604 end
3605 last_v = library_flags[flagName]
3606 library_flags[flagName] = str
3607 if options.Location then
3608 options.Location[options.LocationFlag or flagName] = str
3609 end
3610 update()
3611 return str
3612 end,
3613 Reset = function()
3614 return set(nil, default)
3615 end
3616 }
3617 tabFunctions.Flags[flagName], sectionFunctions.Flags[flagName], elements[flagName] = objectdata, objectdata, objectdata
3618 return objectdata
3619 end
3620 sectionFunctions.AddTextBox = sectionFunctions.AddTextbox
3621 sectionFunctions.NewTextBox = sectionFunctions.AddTextbox
3622 sectionFunctions.CreateTextBox = sectionFunctions.AddTextbox
3623 sectionFunctions.TextBox = sectionFunctions.AddTextbox
3624 sectionFunctions.NewTextbox = sectionFunctions.AddTextbox
3625 sectionFunctions.CreateTextbox = sectionFunctions.AddTextbox
3626 sectionFunctions.Textbox = sectionFunctions.AddTextbox
3627 sectionFunctions.Box = sectionFunctions.AddTextbox
3628 function sectionFunctions:AddKeybind(options, ...)
3629 options = (options and type(options) == "string" and resolvevararg("Keybind", options, ...)) or options
3630 local keybindName, presetKeybind, callback, presscallback, flag = assert(options.Name, "Missing Name for new keybind."), options.Value, options.Callback, options.Pressed, options.Flag or (function()
3631 library.unnamedkeybinds = 1 + (library.unnamedkeybinds or 0)
3632 return "Keybind" .. tostring(library.unnamedkeybinds)
3633 end)()
3634 local IsCore = (options.CoreBinding and true) or nil
3635 if elements[flag] ~= nil then
3636 warn(debug.traceback("Warning! Re-used flag '" .. flag .. "'", 3))
3637 end
3638 library.keyHandler = keyHandler
3639 local keyHandler = options.KeyNames or keyHandler
3640 local newKeybind = Instance_new("Frame")
3641 local keybindHeadline = Instance_new("TextLabel")
3642 local keybindPositioner = Instance_new("Frame")
3643 local keybindList = Instance_new("UIListLayout")
3644 local keybindButton = Instance_new("TextButton")
3645 local bindedKey = presetKeybind
3646 local justBinded = false
3647 local keyName = (presetKeybind and tostring(presetKeybind):gsub("Enum.KeyCode.", "") or "")
3648 newKeybind.Name = "newKeybind"
3649 newKeybind.Parent = sectionHolder
3650 newKeybind.BackgroundColor3 = Color3.new(1, 1, 1)
3651 newKeybind.BackgroundTransparency = 1
3652 newKeybind.Size = UDim2.new(1, 0, 0, 19)
3653 keybindHeadline.Name = "keybindHeadline"
3654 keybindHeadline.Parent = newKeybind
3655 keybindHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
3656 keybindHeadline.BackgroundTransparency = 1
3657 keybindHeadline.Position = UDim2.fromScale(0.031, 0.165842161)
3658 keybindHeadline.Size = UDim2.fromOffset(215, 12)
3659 keybindHeadline.Font = Enum.Font.Code
3660 keybindHeadline.Text = (keybindName and tostring(keybindName)) or "???"
3661 keybindHeadline.TextColor3 = library.colors.elementText
3662 colored[1 + #colored] = {keybindHeadline, "TextColor3", "elementText"}
3663 keybindHeadline.TextSize = 14
3664 keybindHeadline.TextXAlignment = Enum.TextXAlignment.Left
3665 keybindPositioner.Name = "keybindPositioner"
3666 keybindPositioner.Parent = newKeybind
3667 keybindPositioner.BackgroundColor3 = Color3.new(1, 1, 1)
3668 keybindPositioner.BackgroundTransparency = 1
3669 keybindPositioner.Position = UDim2.new(0.00448430516)
3670 keybindPositioner.Size = UDim2.fromOffset(214, 19)
3671 keybindList.Name = "keybindList"
3672 keybindList.Parent = keybindPositioner
3673 keybindList.FillDirection = Enum.FillDirection.Horizontal
3674 keybindList.HorizontalAlignment = Enum.HorizontalAlignment.Right
3675 keybindList.SortOrder = Enum.SortOrder.LayoutOrder
3676 keybindList.VerticalAlignment = Enum.VerticalAlignment.Center
3677 keybindButton.Name = "keybindButton"
3678 keybindButton.Parent = keybindPositioner
3679 keybindButton.Active = false
3680 keybindButton.BackgroundColor3 = Color3.new(1, 1, 1)
3681 keybindButton.BackgroundTransparency = 1
3682 keybindButton.Position = UDim2.fromScale(0.598130822, 0.184210524)
3683 keybindButton.Selectable = false
3684 keybindButton.Size = UDim2.fromOffset(46, 12)
3685 keybindButton.Font = Enum.Font.Code
3686 keybindButton.Text = (presetKeybind and tostring(presetKeybind):gsub("Enum.KeyCode.", "") or "[NONE]")
3687 keybindButton.TextColor3 = library.colors.otherElementText
3688 local colored_keybindButton_TextColor3 = {keybindButton, "TextColor3", "otherElementText"}
3689 colored[1 + #colored] = colored_keybindButton_TextColor3
3690 keybindButton.TextSize = 14
3691 keybindButton.TextXAlignment = Enum.TextXAlignment.Right
3692 keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
3693 sectionFunctions:Update()
3694 local last_v = bindedKey or presetKeybind
3695 local function newkey()
3696 local IgnoreKey = nil
3697 if IsCore then
3698 IgnoreKey = tick()
3699 IgnoreCoreInputs = IgnoreKey
3700 end
3701 local old_texts = keybindButton.Text
3702 colored_keybindButton_TextColor3[3] = "main"
3703 colored_keybindButton_TextColor3[4] = nil
3704 tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
3705 TextColor3 = library.colors.main
3706 }):Play()
3707 if last_v then
3708 keybindButton.Text = "(Was " .. (last_v and tostring(last_v):gsub("Enum.KeyCode.", "") or "[NONE]") .. ") [...]"
3709 else
3710 keybindButton.Text = "[...]"
3711 end
3712 local receivingKey = nil
3713 receivingKey = userInputService.InputBegan:Connect(function(key)
3714 last_v = library_flags[flag]
3715 if not keyHandler.notAllowedKeys[key.KeyCode] then
3716 if key.KeyCode ~= Enum.KeyCode.Unknown then
3717 bindedKey = (key.KeyCode ~= Enum.KeyCode.Escape and key.KeyCode) or library_flags[flag]
3718 library_flags[flag] = bindedKey
3719 if options.Location then
3720 options.Location[options.LocationFlag or flag] = bindedKey
3721 end
3722 if bindedKey then
3723 keyName = keyHandler.allowedKeys[bindedKey]
3724 keybindButton.Text = "[" .. (keyName or bindedKey.Name or tostring(key.KeyCode):gsub("Enum.KeyCode.", "")) .. "]"
3725 keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
3726 justBinded = true
3727 colored_keybindButton_TextColor3[3] = "otherElementText"
3728 colored_keybindButton_TextColor3[4] = nil
3729 tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
3730 TextColor3 = library.colors.otherElementText
3731 }):Play()
3732 receivingKey:Disconnect()
3733 end
3734 if callback and last_v ~= bindedKey then
3735 task.spawn(callback, bindedKey, last_v)
3736 end
3737 if IsCore then
3738 delay(0.1, function()
3739 if IgnoreCoreInputs and (IgnoreCoreInputs == IgnoreKey) then
3740 IgnoreCoreInputs = nil
3741 end
3742 end)
3743 end
3744 return
3745 elseif key.KeyCode == Enum.KeyCode.Unknown and not keyHandler.notAllowedMouseInputs[key.UserInputType] then
3746 bindedKey = key.UserInputType
3747 library_flags[flag] = bindedKey
3748 if options.Location then
3749 options.Location[options.LocationFlag or flag] = bindedKey
3750 end
3751 keyName = keyHandler.allowedKeys[bindedKey]
3752 keybindButton.Text = "[" .. (keyName or bindedKey.Name or tostring(key.KeyCode):gsub("Enum.KeyCode.", "")) .. "]"
3753 keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
3754 justBinded = true
3755 colored_keybindButton_TextColor3[3] = "otherElementText"
3756 colored_keybindButton_TextColor3[4] = nil
3757 tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
3758 TextColor3 = library.colors.otherElementText
3759 }):Play()
3760 receivingKey:Disconnect()
3761 if callback and last_v ~= bindedKey then
3762 task.spawn(callback, bindedKey, last_v)
3763 end
3764 if IsCore then
3765 delay(0.1, function()
3766 if IgnoreCoreInputs and (IgnoreCoreInputs == IgnoreKey) then
3767 IgnoreCoreInputs = nil
3768 end
3769 end)
3770 end
3771 return
3772 end
3773 end
3774 if key.KeyCode == Enum.KeyCode.Backspace or Enum.KeyCode.Escape == key.KeyCode then
3775 old_texts, bindedKey = "[NONE]", nil
3776 end
3777 keybindButton.Text = old_texts
3778 colored_keybindButton_TextColor3[3] = "otherElementText"
3779 colored_keybindButton_TextColor3[4] = nil
3780 tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
3781 TextColor3 = library.colors.otherElementText
3782 }):Play()
3783 receivingKey:Disconnect()
3784 if callback and last_v ~= bindedKey then
3785 task.spawn(callback, bindedKey, last_v)
3786 end
3787 end)
3788 library.signals[1 + #library.signals] = receivingKey
3789 end
3790 library.signals[1 + #library.signals] = keybindButton.MouseButton1Click:Connect(newkey)
3791 library.signals[1 + #library.signals] = newKeybind.InputEnded:Connect(function(input)
3792 if not library.colorpicker and not submenuOpen and input.UserInputType == Enum.UserInputType.MouseButton1 then
3793 newkey()
3794 end
3795 end)
3796 if presscallback then
3797 library.signals[1 + #library.signals] = userInputService.InputBegan:Connect(function(key, chatting)
3798 if not keyHandler.notAllowedKeys[key.KeyCode] and not keyHandler.notAllowedMouseInputs[key.UserInputType] then
3799 if not justBinded and bindedKey == key.UserInputType or not justBinded and bindedKey == key.KeyCode and not chatting then
3800 if presscallback then
3801 task.spawn(presscallback, key, chatting)
3802 end
3803 end
3804 if justBinded then
3805 justBinded = false
3806 end
3807 end
3808 end)
3809 end
3810 local function set(t, key)
3811 if (nil == key) and (t ~= nil) then
3812 key = t
3813 end
3814 if (key == "nil") or (key == "NONE") or (key == "none") then
3815 key = nil
3816 end
3817 last_v = library_flags[flag]
3818 bindedKey = key
3819 library_flags[flag] = key
3820 if options.Location then
3821 options.Location[options.LocationFlag or flag] = key
3822 end
3823 keyName = (key == nil and "NONE") or keyHandler.allowedKeys[key]
3824 keybindButton.Text = "[" .. (keyName or key.Name or tostring(key):gsub("Enum.KeyCode.", "")) .. "]"
3825 keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
3826 justBinded = true
3827 colored_keybindButton_TextColor3[3] = "otherElementText"
3828 colored_keybindButton_TextColor3[4] = nil
3829 tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
3830 TextColor3 = library.colors.otherElementText
3831 }):Play()
3832 if callback and ((last_v ~= key) or options.AllowDuplicateCalls) then
3833 task.spawn(callback, key, last_v)
3834 end
3835 return key
3836 end
3837 if presetKeybind ~= nil then
3838 set(presetKeybind)
3839 else
3840 library_flags[flag] = bindedKey
3841 if options.Location then
3842 options.Location[options.LocationFlag or flag] = bindedKey
3843 end
3844 end
3845 local default = library_flags[flag]
3846 local function update()
3847 keybindName, callback, presscallback = options.Name or keybindName, options.Callback, options.Pressed
3848 local key = library_flags[flag]
3849 keyName = (key == nil and "NONE") or keyHandler.allowedKeys[key]
3850 keybindButton.Text = "[" .. (keyName or key.Name or tostring(key):gsub("Enum.KeyCode.", "")) .. "]"
3851 keybindButton.Size = UDim2.fromOffset(textToSize(keybindButton).X + 4, 12)
3852 colored_keybindButton_TextColor3[3] = "otherElementText"
3853 colored_keybindButton_TextColor3[4] = nil
3854 tweenService:Create(keybindButton, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
3855 TextColor3 = library.colors.otherElementText
3856 }):Play()
3857 keybindHeadline.Text = (keybindName and tostring(keybindName)) or "???"
3858 return key
3859 end
3860 local objectdata = {
3861 Options = options,
3862 Name = flag,
3863 Flag = flag,
3864 Type = "Keybind",
3865 Default = default,
3866 Parent = sectionFunctions,
3867 Instance = keybindButton,
3868 Get = function()
3869 return library_flags[flag]
3870 end,
3871 Set = set,
3872 Remove = function()
3873 if newKeybind then
3874 newKeybind.Parent = nil
3875 sectionFunctions:Update()
3876 end
3877 end,
3878 RawSet = function(t, key)
3879 if nil == key and t ~= nil then
3880 key = t
3881 end
3882 if key == "nil" or key == "NONE" or key == "none" then
3883 key = nil
3884 end
3885 last_v = library_flags[flag]
3886 bindedKey = key
3887 library_flags[flag] = key
3888 if options.Location then
3889 options.Location[options.LocationFlag or flag] = key
3890 end
3891 justBinded = true
3892 return key
3893 end,
3894 Update = update,
3895 Reset = function()
3896 return set(nil, default)
3897 end
3898 }
3899 tabFunctions.Flags[flag], sectionFunctions.Flags[flag], elements[flag] = objectdata, objectdata, objectdata
3900 return objectdata
3901 end
3902 sectionFunctions.NewKeybind = sectionFunctions.AddKeybind
3903 sectionFunctions.CreateKeybind = sectionFunctions.AddKeybind
3904 sectionFunctions.Keybind = sectionFunctions.AddKeybind
3905 sectionFunctions.Bind = sectionFunctions.AddKeybind
3906 function sectionFunctions:AddLabel(options, ...)
3907 options = (options and type(options) == "string" and resolvevararg("Label", options, ...)) or options
3908 local labelName, flag = options.Text or options.Value or options.Name, options.Flag or (function()
3909 library.unnamedlabels = 1 + (library.unnamedlabels or 0)
3910 return "Label" .. tostring(library.unnamedlabels)
3911 end)()
3912 if elements[flag] ~= nil then
3913 warn(debug.traceback("Warning! Re-used flag '" .. flag .. "'", 3))
3914 end
3915 local newLabel = Instance_new("Frame")
3916 local labelHeadline = Instance_new("TextLabel")
3917 local labelPositioner = Instance_new("Frame")
3918 local labelButton = Instance_new("TextButton")
3919 newLabel.Name = "newLabel"
3920 newLabel.Parent = sectionHolder
3921 newLabel.BackgroundColor3 = Color3.new(1, 1, 1)
3922 newLabel.BackgroundTransparency = 1
3923 newLabel.Size = UDim2.new(1, 0, 0, 19)
3924 labelHeadline.Name = "labelHeadline"
3925 labelHeadline.Parent = newLabel
3926 labelHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
3927 labelHeadline.BackgroundTransparency = 1
3928 labelHeadline.Position = UDim2.fromScale(0.031, 0.165842161)
3929 labelHeadline.Size = UDim2.fromOffset(215, 12)
3930 labelHeadline.Font = Enum.Font.Code
3931 labelHeadline.Text = (labelName and tostring(labelName)) or "Empty Text"
3932 labelHeadline.TextColor3 = library.colors.elementText
3933 colored[1 + #colored] = {labelHeadline, "TextColor3", "elementText"}
3934 labelHeadline.TextSize = 14
3935 labelHeadline.TextXAlignment = Enum.TextXAlignment.Left
3936 labelPositioner.Name = "labelPositioner"
3937 labelPositioner.Parent = newLabel
3938 labelPositioner.BackgroundColor3 = Color3.new(1, 1, 1)
3939 labelPositioner.BackgroundTransparency = 1
3940 labelPositioner.Position = UDim2.new(0.00448430516)
3941 labelPositioner.Size = UDim2.fromOffset(214, 19)
3942 sectionFunctions:Update()
3943 local function set(t, str)
3944 if nil == str and t ~= nil then
3945 str = t
3946 end
3947 labelHeadline.Text = (nil ~= str and tostring(str)) or "Empty Text"
3948 return str
3949 end
3950 local default = labelHeadline.Text
3951 local objectdata = {
3952 Options = options,
3953 Name = flag,
3954 Flag = flag,
3955 Type = "Label",
3956 Default = default,
3957 Parent = sectionFunctions,
3958 Instance = labelHeadline,
3959 Get = function()
3960 return labelHeadline.Text, labelHeadline
3961 end,
3962 Set = set,
3963 SetText = set,
3964 Remove = function()
3965 if newLabel then
3966 newLabel.Parent = nil
3967 sectionFunctions:Update()
3968 end
3969 end,
3970 RawSet = set,
3971 Update = function()
3972 return labelHeadline.Text
3973 end,
3974 Reset = function()
3975 return set(nil, default)
3976 end
3977 }
3978 tabFunctions.Flags[flag], sectionFunctions.Flags[flag], elements[flag] = objectdata, objectdata, objectdata
3979 return objectdata
3980 end
3981 sectionFunctions.NewLabel = sectionFunctions.AddLabel
3982 sectionFunctions.CreateLabel = sectionFunctions.AddLabel
3983 sectionFunctions.Label = sectionFunctions.AddLabel
3984 sectionFunctions.Text = sectionFunctions.AddLabel
3985 function sectionFunctions:AddSlider(options, ...)
3986 options = (options and type(options) == "string" and resolvevararg("Slider", options, ...)) or options
3987 local sliderName, maxValue, minValue, presetValue, callback, flagName = assert(options.Name, "Missing Name for new slider."), assert(options.Max, "Missing Max for new slider."), assert(options.Min, "Missing Min for new slider."), options.Value, options.Callback, options.Flag or (function()
3988 library.unnamedsliders = 1 + (library.unnamedsliders or 0)
3989 return "Slider" .. tostring(library.unnamedsliders)
3990 end)()
3991 if elements[flagName] ~= nil then
3992 warn(debug.traceback("Warning! Re-used flag '" .. flagName .. "'", 3))
3993 end
3994 local decimalprecision = tonumber(options.Decimals or options.Precision or options.Precise)
3995 if not decimalprecision and options.Max - options.Min <= 1 then
3996 decimalprecision = 1
3997 end
3998 if decimalprecision then
3999 decimalprecision = math.clamp(decimalprecision, 0, 99)
4000 if decimalprecision <= 0 then
4001 decimalprecision = nil
4002 end
4003 decimalprecision = tostring(decimalprecision)
4004 end
4005 local formattyp = options.Format and type(options.Format)
4006 local function resolvedisplay(val, was)
4007 local str = nil
4008 if decimalprecision then
4009 str = string.format("%0." .. decimalprecision .. "f", val)
4010 end
4011 str = str or tostring(val)
4012 if formattyp == "string" then
4013 return string.format(options.Format, val)
4014 elseif formattyp == "function" then
4015 local oof, g = pcall(options.Format, val, was)
4016 if not oof or not g then
4017 warn("Your format function for", sliderName, "Slider:", flagName, "has returned nothing. It should return a string to display.", debug.traceback(""))
4018 return "Format Function Errored"
4019 end
4020 return tostring(g)
4021 end
4022 return (sliderName or "???") .. ": " .. str
4023 end
4024 local usetextbox = options.Textbox or options.InputBox or options.CustomInput
4025 local newSlider = Instance_new("Frame")
4026 local slider = Instance_new("ImageLabel")
4027 local sliderInner = Instance_new("ImageLabel")
4028 local sliderColored = Instance_new("ImageLabel")
4029 local sliderHeadline = Instance_new("TextLabel")
4030 local startingValue = presetValue or minValue
4031 local sliderDragging = false
4032 newSlider.Name = "newSlider"
4033 newSlider.Parent = sectionHolder
4034 newSlider.BackgroundColor3 = Color3.new(1, 1, 1)
4035 newSlider.BackgroundTransparency = 1
4036 newSlider.Size = UDim2.new(1, 0, 0, 42)
4037 slider.Name = "slider"
4038 slider.Parent = newSlider
4039 slider.Active = true
4040 slider.BackgroundColor3 = library.colors.topGradient
4041 local colored_slider_BackgroundColor3 = {slider, "BackgroundColor3", "topGradient"}
4042 colored[1 + #colored] = colored_slider_BackgroundColor3
4043 slider.BorderColor3 = library.colors.elementBorder
4044 colored[1 + #colored] = {slider, "BorderColor3", "elementBorder"}
4045 slider.Position = UDim2.fromScale(0.031, 0.48)
4046 slider.Selectable = true
4047 slider.Size = (usetextbox and UDim2.fromOffset(156, 18)) or UDim2.fromOffset(206, 18)
4048 slider.Image = "rbxassetid://2454009026"
4049 slider.ImageColor3 = library.colors.bottomGradient
4050 local colored_slider_ImageColor3 = {slider, "ImageColor3", "bottomGradient"}
4051 colored[1 + #colored] = colored_slider_ImageColor3
4052 sliderInner.Name = "sliderInner"
4053 sliderInner.Parent = slider
4054 sliderInner.Active = true
4055 sliderInner.AnchorPoint = Vector2.new(0.5, 0.5)
4056 sliderInner.BackgroundColor3 = library.colors.topGradient
4057 colored[1 + #colored] = {sliderInner, "BackgroundColor3", "topGradient"}
4058 sliderInner.BorderColor3 = library.colors.elementBorder
4059 colored[1 + #colored] = {sliderInner, "BorderColor3", "elementBorder"}
4060 sliderInner.Position = UDim2.fromScale(0.5, 0.5)
4061 sliderInner.Selectable = true
4062 sliderInner.Size = UDim2.new(1, -4, 1, -4)
4063 sliderInner.Image = "rbxassetid://2454009026"
4064 sliderInner.ImageColor3 = library.colors.bottomGradient
4065 colored[1 + #colored] = {sliderInner, "ImageColor3", "bottomGradient"}
4066 sliderColored.Name = "sliderColored"
4067 sliderColored.Parent = sliderInner
4068 sliderColored.Active = true
4069 sliderColored.BackgroundColor3 = darkenColor(library.colors.main, 1.5)
4070 colored[1 + #colored] = {sliderColored, "BackgroundColor3", "main", 1.5}
4071 sliderColored.BorderSizePixel = 0
4072 sliderColored.Selectable = true
4073 sliderColored.Size = UDim2.fromScale(((startingValue or minValue) - minValue) / (maxValue - minValue), 1)
4074 sliderColored.Image = "rbxassetid://2454009026"
4075 sliderColored.ImageColor3 = darkenColor(library.colors.main, 2.5)
4076 colored[1 + #colored] = {sliderColored, "ImageColor3", "main", 2.5}
4077 sliderHeadline.Name = "sliderHeadline"
4078 sliderHeadline.Parent = newSlider
4079 sliderHeadline.Active = true
4080 sliderHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
4081 sliderHeadline.BackgroundTransparency = 1
4082 sliderHeadline.Position = UDim2.new(0.031)
4083 sliderHeadline.Selectable = true
4084 sliderHeadline.Size = UDim2.fromOffset(206, 20)
4085 sliderHeadline.ZIndex = 5
4086 sliderHeadline.Font = Enum.Font.Code
4087 sliderHeadline.LineHeight = 1.15
4088 sliderHeadline.Text = resolvedisplay(startingValue)
4089 sliderHeadline.TextColor3 = library.colors.elementText
4090 colored[1 + #colored] = {sliderHeadline, "TextColor3", "elementText"}
4091 sliderHeadline.TextSize = 14
4092 sliderHeadline.TextXAlignment = Enum.TextXAlignment.Left
4093 local realTextbox = nil
4094 local function Set(t, newValue)
4095 if nil == newValue and t ~= nil then
4096 newValue = t
4097 end
4098 minValue, maxValue = options.Min, options.Max
4099 if newValue and (options.IllegalInput or ((not minValue or newValue >= minValue) and (not maxValue or newValue <= maxValue))) then
4100 local last_val = library_flags[flagName]
4101 library_flags[flagName] = newValue
4102 if options.Location then
4103 options.Location[options.LocationFlag or flagName] = newValue
4104 end
4105 do
4106 local newValue = (options.IllegalInput and math.clamp(newValue, minValue or -math.huge, maxValue or math.huge)) or newValue
4107 tweenService:Create(sliderColored, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
4108 Size = UDim2.fromScale(((newValue or minValue) - minValue) / (maxValue - minValue), 1)
4109 }):Play()
4110 end
4111 sliderHeadline.Text = resolvedisplay(newValue, last_val)
4112 if usetextbox and realTextbox then
4113 realTextbox.Text = tostring(newValue)
4114 end
4115 if callback and (last_val ~= newValue or options.AllowDuplicateCalls) then
4116 task.spawn(callback, newValue, last_val)
4117 end
4118 end
4119 return newValue
4120 end
4121 if presetValue ~= nil then
4122 Set(presetValue)
4123 else
4124 library_flags[flagName] = startingValue
4125 if options.Location then
4126 options.Location[options.LocationFlag or flagName] = startingValue
4127 end
4128 end
4129 if usetextbox then
4130 if type(usetextbox) ~= "table" then
4131 usetextbox = options
4132 end
4133 local textbox = Instance_new("ImageLabel")
4134 local textboxInner = Instance_new("ImageLabel")
4135 realTextbox = Instance_new("TextBox")
4136 textbox.Name = "textbox"
4137 textbox.Parent = newSlider
4138 textbox.Active = true
4139 textbox.BackgroundColor3 = library.colors.topGradient
4140 local colored_textbox_BackgroundColor3 = {textbox, "BackgroundColor3", "topGradient"}
4141 colored[1 + #colored] = colored_textbox_BackgroundColor3
4142 textbox.BorderColor3 = library.colors.elementBorder
4143 colored[1 + #colored] = {textbox, "BorderColor3", "elementBorder"}
4144 textbox.Position = UDim2.new(1, -54, 0.48)
4145 textbox.Selectable = true
4146 textbox.Size = UDim2.fromOffset(43, 18)
4147 textbox.Image = "rbxassetid://2454009026"
4148 textbox.ImageColor3 = library.colors.bottomGradient
4149 local colored_textbox_ImageColor3 = {textbox, "ImageColor3", "bottomGradient"}
4150 colored[1 + #colored] = colored_textbox_ImageColor3
4151 textboxInner.Name = "textboxInner"
4152 textboxInner.Parent = textbox
4153 textboxInner.Active = true
4154 textboxInner.AnchorPoint = Vector2.new(0.5, 0.5)
4155 textboxInner.BackgroundColor3 = library.colors.topGradient
4156 colored[1 + #colored] = {textboxInner, "BackgroundColor3", "topGradient"}
4157 textboxInner.BorderColor3 = library.colors.elementBorder
4158 colored[1 + #colored] = {textboxInner, "BorderColor3", "elementBorder"}
4159 textboxInner.Position = UDim2.fromScale(0.5, 0.5)
4160 textboxInner.Selectable = true
4161 textboxInner.Size = UDim2.new(1, -4, 1, -4)
4162 textboxInner.Image = "rbxassetid://2454009026"
4163 textboxInner.ImageColor3 = library.colors.bottomGradient
4164 colored[1 + #colored] = {textboxInner, "ImageColor3", "bottomGradient"}
4165 realTextbox.Name = "realTextbox"
4166 realTextbox.Parent = textbox
4167 realTextbox.BackgroundColor3 = Color3.new(1, 1, 1)
4168 realTextbox.BackgroundTransparency = 1
4169 realTextbox.Position = UDim2.new(0.0295485705)
4170 realTextbox.Size = UDim2.fromScale(0.97, 1)
4171 realTextbox.ZIndex = 5
4172 realTextbox.ClearTextOnFocus = false
4173 realTextbox.Font = Enum.Font.Code
4174 realTextbox.LineHeight = 1.15
4175 realTextbox.Text = tostring(presetValue)
4176 realTextbox.TextColor3 = library.colors.otherElementText
4177 colored[1 + #colored] = {realTextbox, "TextColor3", "otherElementText"}
4178 realTextbox.TextSize = 14
4179 realTextbox.PlaceholderText = (presetValue ~= nil and tostring(presetValue)) or ""
4180 library.signals[1 + #library.signals] = realTextbox.FocusLost:Connect(function()
4181 local val = realTextbox.Text
4182 if usetextbox.PreFormat then
4183 local typ = type(usetextbox.PreFormat)
4184 if typ == "function" then
4185 local x, e = pcall(usetextbox.PreFormat, val)
4186 if not x and e then
4187 warn("Error in Pre-Format (Textbox " .. flagName .. "):", e)
4188 else
4189 val = e
4190 end
4191 end
4192 end
4193 val = (not usetextbox.Hex and not usetextbox.Binary and not usetextbox.Base and (tonumber(val) or tonumber(val:gsub("%D", ""), 10) or 0)) or tonumber(val, (usetextbox.Hex and 16) or (usetextbox.Binary and 2) or usetextbox.Base or 10) or 0
4194 if not options.IllegalInput and (options.Max or options.Min) then
4195 val = math.clamp(val, options.Min or -math.huge, options.Max or math.huge)
4196 end
4197 local decimalprecision = tonumber(options.Decimals or options.Precision or options.Precise)
4198 if decimalprecision then
4199 val = tonumber(string.format("%0." .. tostring(decimalprecision) .. "f", val))
4200 end
4201 if usetextbox.PostFormat then
4202 local typ = type(usetextbox.PostFormat)
4203 if typ == "function" then
4204 local x, e = pcall(usetextbox.PostFormat, val)
4205 if not x and e then
4206 warn("Error in Post-Format (Textbox " .. flagName .. "):", e)
4207 else
4208 val = e
4209 end
4210 end
4211 end
4212 Set((val and tonumber(val)) or presetValue or 0)
4213 end)
4214 library.signals[1 + #library.signals] = textbox.MouseEnter:Connect(function()
4215 colored_textbox_BackgroundColor3[3] = "main"
4216 colored_textbox_BackgroundColor3[4] = 1.5
4217 colored_textbox_ImageColor3[3] = "main"
4218 colored_textbox_ImageColor3[4] = 2.5
4219 tweenService:Create(textbox, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
4220 BackgroundColor3 = darkenColor(library.colors.main, 1.5),
4221 ImageColor3 = darkenColor(library.colors.main, 2.5)
4222 }):Play()
4223 end)
4224 library.signals[1 + #library.signals] = textbox.MouseLeave:Connect(function()
4225 colored_textbox_BackgroundColor3[3] = "topGradient"
4226 colored_textbox_BackgroundColor3[4] = nil
4227 colored_textbox_ImageColor3[3] = "bottomGradient"
4228 colored_textbox_ImageColor3[4] = nil
4229 tweenService:Create(textbox, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
4230 BackgroundColor3 = library.colors.topGradient,
4231 ImageColor3 = library.colors.bottomGradient
4232 }):Play()
4233 end)
4234 end
4235 sectionFunctions:Update()
4236 library.signals[1 + #library.signals] = slider.MouseEnter:Connect(function()
4237 colored_slider_BackgroundColor3[3] = "main"
4238 colored_slider_BackgroundColor3[4] = 1.5
4239 colored_slider_ImageColor3[3] = "main"
4240 colored_slider_ImageColor3[4] = 2.5
4241 tweenService:Create(slider, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
4242 BackgroundColor3 = darkenColor(library.colors.main, 1.5),
4243 ImageColor3 = darkenColor(library.colors.main, 2.5)
4244 }):Play()
4245 end)
4246 library.signals[1 + #library.signals] = slider.MouseLeave:Connect(function()
4247 colored_slider_BackgroundColor3[3] = "topGradient"
4248 colored_slider_BackgroundColor3[4] = nil
4249 colored_slider_ImageColor3[3] = "bottomGradient"
4250 colored_slider_ImageColor3[4] = nil
4251 tweenService:Create(slider, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
4252 BackgroundColor3 = library.colors.topGradient,
4253 ImageColor3 = library.colors.bottomGradient
4254 }):Play()
4255 end)
4256 local function sliding(input, sb, sc)
4257 local last_val = library_flags[flagName]
4258 local pos = UDim2.fromScale(math.clamp((input.Position.X - sb.AbsolutePosition.X) / sb.AbsoluteSize.X, 0, 1), 1)
4259 tweenService:Create(sc, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
4260 Size = pos
4261 }):Play()
4262 local sliderValue = nil
4263 if decimalprecision then
4264 sliderValue = tonumber(string.format("%0." .. decimalprecision .. "f", ((pos.X.Scale * maxValue) / maxValue) * (maxValue - minValue) + minValue))
4265 end
4266 sliderValue = sliderValue or tonumber(string.format("%0.2f", (floor(((pos.X.Scale * maxValue) / maxValue) * (maxValue - minValue) + minValue))))
4267 library_flags[flagName] = sliderValue
4268 if options.Location then
4269 options.Location[options.LocationFlag or flagName] = sliderValue
4270 end
4271 sliderHeadline.Text = resolvedisplay(sliderValue, last_val)
4272 if usetextbox and realTextbox then
4273 realTextbox.Text = tostring(sliderValue)
4274 end
4275 if callback and last_val ~= sliderValue then
4276 task.spawn(callback, sliderValue, last_val)
4277 end
4278 last_val = sliderValue
4279 end
4280 library.signals[1 + #library.signals] = newSlider.InputBegan:Connect(function(input)
4281 if not library.colorpicker and input.UserInputType == Enum.UserInputType.MouseButton1 then
4282 sliderDragging = true
4283 isDraggingSomething = true
4284 end
4285 end)
4286 library.signals[1 + #library.signals] = newSlider.InputEnded:Connect(function(input)
4287 if not library.colorpicker and input.UserInputType == Enum.UserInputType.MouseButton1 then
4288 sliderDragging = false
4289 isDraggingSomething = false
4290 end
4291 end)
4292 library.signals[1 + #library.signals] = newSlider.InputBegan:Connect(function(input)
4293 if not library.colorpicker and not isDraggingSomething and input.UserInputType == Enum.UserInputType.MouseButton1 then
4294 isDraggingSomething = true
4295 sliding(input, sliderInner, sliderColored)
4296 end
4297 end)
4298 library.signals[1 + #library.signals] = userInputService.InputChanged:Connect(function(input)
4299 if not library.colorpicker and sliderDragging and input.UserInputType == Enum.UserInputType.MouseMovement then
4300 sliding(input, sliderInner, sliderColored)
4301 end
4302 end)
4303 local default = library_flags[flagName]
4304 local function Update(t, last_val)
4305 if last_val == nil and t ~= nil and type(t) ~= "table" then
4306 last_val = t
4307 end
4308 sliderName, maxValue, minValue, callback = options.Name or sliderName, options.Max or maxValue, options.Min or minValue, options.Callback
4309 local newValue = library_flags[flagName]
4310 do
4311 local newValue = math.clamp(newValue, options.Min or -math.huge, options.Max or math.huge)
4312 tweenService:Create(sliderColored, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
4313 Size = UDim2.fromScale(((newValue or minValue) - minValue) / (maxValue - minValue), 1)
4314 }):Play()
4315 end
4316 sliderHeadline.Text = resolvedisplay(newValue, last_val)
4317 if usetextbox and realTextbox then
4318 realTextbox.Text = tostring(newValue)
4319 end
4320 return newValue
4321 end
4322 local objectdata = {
4323 Options = options,
4324 Name = flagName,
4325 Flag = flagName,
4326 Type = "Slider",
4327 Default = default,
4328 Parent = sectionFunctions,
4329 Instance = sliderHeadline,
4330 Set = Set,
4331 Get = function()
4332 return library_flags[flagName]
4333 end,
4334 SetConstraints = function(t, min, max)
4335 if t and type(t) ~= "table" then
4336 min, max = t, min
4337 end
4338 if min then
4339 options.Min = min
4340 end
4341 if max then
4342 options.Max = max
4343 end
4344 Update()
4345 end,
4346 SetMin = function(t, min)
4347 if min == nil and t ~= nil then
4348 min = t
4349 end
4350 if min and min ~= options.Min then
4351 options.Min = min
4352 Update()
4353 end
4354 end,
4355 SetMax = function(t, max)
4356 if max == nil and t ~= nil then
4357 max = t
4358 end
4359 if max and max ~= options.Max then
4360 options.Max = max
4361 Update()
4362 end
4363 end,
4364 Update = Update,
4365 Remove = function()
4366 if newSlider then
4367 newSlider.Parent = nil
4368 sectionFunctions:Update()
4369 end
4370 end,
4371 RawSet = function(t, newValue)
4372 if nil == newValue and t ~= nil then
4373 newValue = t
4374 end
4375 local last_val = library_flags[flagName]
4376 library_flags[flagName] = newValue
4377 if options.Location then
4378 options.Location[options.LocationFlag or flagName] = newValue
4379 end
4380 Update(nil, last_val)
4381 end,
4382 Reset = function()
4383 return Set(nil, default)
4384 end
4385 }
4386 tabFunctions.Flags[flagName], sectionFunctions.Flags[flagName], elements[flagName] = objectdata, objectdata, objectdata
4387 return objectdata
4388 end
4389 sectionFunctions.NewSlider = sectionFunctions.AddSlider
4390 sectionFunctions.CreateSlider = sectionFunctions.AddSlider
4391 sectionFunctions.NumberConstraint = sectionFunctions.AddSlider
4392 sectionFunctions.Slider = sectionFunctions.AddSlider
4393 sectionFunctions.Slide = sectionFunctions.AddSlider
4394 function sectionFunctions:AddSearchBox(options, ...)
4395 options = (options and (type(options) == "string") and resolvevararg("SearchBox", options, ...)) or options
4396 local dropdownName, listt, val, callback, flagName = assert(options.Name, "Missing Name for new searchbox."), assert(options.List, "Missing List for new searchbox."), options.Value, options.Callback, options.Flag or (function()
4397 library.unnamedsearchbox = 1 + (library.unnamedsearchbox or 0)
4398 return "SearchBox" .. tostring(library.unnamedsearchbox)
4399 end)()
4400 if elements[flagName] ~= nil then
4401 warn(debug.traceback("Warning! Re-used flag '" .. flagName .. "'", 3))
4402 end
4403 local newDropdown = Instance_new("Frame")
4404 local dropdown = Instance_new("ImageLabel")
4405 local dropdownInner = Instance_new("ImageLabel")
4406 local dropdownToggle = Instance_new("ImageButton")
4407 local dropdownSelection = Instance_new("TextBox")
4408 local dropdownHeadline = Instance_new("TextLabel")
4409 local dropdownHolderFrame = Instance_new("ImageLabel")
4410 local dropdownHolderInner = Instance_new("ImageLabel")
4411 local realDropdownHolder = Instance_new("ScrollingFrame")
4412 local realDropdownHolderList = Instance_new("UIListLayout")
4413 local dropdownEnabled = false
4414 local resolvelist = getresolver(listt, options.Filter)
4415 local list = resolvelist()
4416 if next(list) then
4417 else
4418 local EmptyVal = options.EmptyValue
4419 if EmptyVal ~= nil then
4420 table.insert(list, 1, EmptyVal)
4421 end
4422 end
4423 local multiselect = options.MultiSelect or options.Multi or options.Multiple
4424 local passed_multiselect = multiselect and type(multiselect)
4425 local blankstring = not multiselect and (options.BlankValue or options.NoValueString or options.Nothing)
4426 local selectedOption = val or list[1] or blankstring
4427 local addcallback = options.ItemAdded or options.AddedCallback
4428 local delcallback = options.ItemRemoved or options.RemovedCallback
4429 local clrcallback = options.ItemsCleared or options.ClearedCallback
4430 local modcallback = options.ItemChanged or options.ChangedCallback
4431 if blankstring and val == nil then
4432 val = blankstring
4433 end
4434 if val ~= nil then
4435 selectedOption = val
4436 end
4437 if multiselect and (not selectedOption or type(selectedOption) ~= "table") then
4438 selectedOption = {}
4439 end
4440 local selectedObjects = {}
4441 local optionCount = 0
4442 newDropdown.Name = "newDropdown"
4443 newDropdown.Parent = sectionHolder
4444 newDropdown.BackgroundColor3 = Color3.new(1, 1, 1)
4445 newDropdown.BackgroundTransparency = 1
4446 newDropdown.Size = UDim2.new(1, 0, 0, 42)
4447 dropdown.Name = "dropdown"
4448 dropdown.Parent = newDropdown
4449 dropdown.Active = true
4450 dropdown.BackgroundColor3 = library.colors.topGradient
4451 local colored_dropdown_BackgroundColor3 = {dropdown, "BackgroundColor3", "topGradient"}
4452 colored[1 + #colored] = colored_dropdown_BackgroundColor3
4453 dropdown.BorderColor3 = library.colors.elementBorder
4454 colored[1 + #colored] = {dropdown, "BorderColor3", "elementBorder"}
4455 dropdown.Position = UDim2.fromScale(0.027, 0.45)
4456 dropdown.Selectable = true
4457 dropdown.Size = UDim2.fromOffset(206, 18)
4458 dropdown.Image = "rbxassetid://2454009026"
4459 dropdown.ImageColor3 = library.colors.bottomGradient
4460 local colored_dropdown_ImageColor3 = {dropdown, "ImageColor3", "bottomGradient"}
4461 colored[1 + #colored] = colored_dropdown_ImageColor3
4462 dropdownInner.Name = "dropdownInner"
4463 dropdownInner.Parent = dropdown
4464 dropdownInner.Active = true
4465 dropdownInner.AnchorPoint = Vector2.new(0.5, 0.5)
4466 dropdownInner.BackgroundColor3 = library.colors.topGradient
4467 colored[1 + #colored] = {dropdownInner, "BackgroundColor3", "topGradient"}
4468 dropdownInner.BorderColor3 = library.colors.elementBorder
4469 colored[1 + #colored] = {dropdownInner, "BorderColor3", "elementBorder"}
4470 dropdownInner.Position = UDim2.fromScale(0.5, 0.5)
4471 dropdownInner.Selectable = true
4472 dropdownInner.Size = UDim2.new(1, -4, 1, -4)
4473 dropdownInner.Image = "rbxassetid://2454009026"
4474 dropdownInner.ImageColor3 = library.colors.bottomGradient
4475 colored[1 + #colored] = {dropdownInner, "ImageColor3", "bottomGradient"}
4476 dropdownToggle.Name = "dropdownToggle"
4477 dropdownToggle.Parent = dropdown
4478 dropdownToggle.BackgroundColor3 = Color3.new(1, 1, 1)
4479 dropdownToggle.BackgroundTransparency = 1
4480 dropdownToggle.Position = UDim2.fromScale(0.9, 0.17)
4481 dropdownToggle.Rotation = 90
4482 dropdownToggle.Size = UDim2.fromOffset(12, 12)
4483 dropdownToggle.ZIndex = 6
4484 dropdownToggle.Image = "rbxassetid://71659683"
4485 dropdownToggle.ImageColor3 = Color3.fromRGB(171, 171, 171)
4486 dropdownSelection.Name = "dropdownSelection"
4487 dropdownSelection.Parent = dropdown
4488 dropdownSelection.BackgroundColor3 = Color3.new(1, 1, 1)
4489 dropdownSelection.BackgroundTransparency = 1
4490 dropdownSelection.Position = UDim2.new(0.0295485705)
4491 dropdownSelection.Size = UDim2.fromScale(0.85, 1)
4492 dropdownSelection.ZIndex = 5
4493 dropdownSelection.Font = Enum.Font.Code
4494 dropdownSelection.LineHeight = 1.15
4495 dropdownSelection.Text = (passed_multiselect == "string" and multiselect) or tostring((multiselect and (blankstring or "Select Item(s)")) or (selectedOption and tostring(selectedOption)) or blankstring or "No Blank String")
4496 dropdownSelection.TextColor3 = library.colors.otherElementText
4497 colored[1 + #colored] = {dropdownSelection, "TextColor3", "otherElementText"}
4498 dropdownSelection.TextSize = 14
4499 dropdownSelection.TextXAlignment = Enum.TextXAlignment.Left
4500 dropdownSelection.ClearTextOnFocus = true
4501 dropdownHeadline.Name = "dropdownHeadline"
4502 dropdownHeadline.Parent = newDropdown
4503 dropdownHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
4504 dropdownHeadline.BackgroundTransparency = 1
4505 dropdownHeadline.Position = UDim2.fromScale(0.034, 0.03)
4506 dropdownHeadline.Size = UDim2.fromOffset(167, 11)
4507 dropdownHeadline.Font = Enum.Font.Code
4508 dropdownHeadline.Text = (dropdownName and tostring(dropdownName)) or "???"
4509 dropdownHeadline.TextColor3 = library.colors.elementText
4510 colored[1 + #colored] = {dropdownHeadline, "TextColor3", "elementText"}
4511 dropdownHeadline.TextSize = 14
4512 dropdownHeadline.TextXAlignment = Enum.TextXAlignment.Left
4513 dropdownHolderFrame.Name = "dropdownHolderFrame"
4514 dropdownHolderFrame.Parent = newDropdown
4515 dropdownHolderFrame.Active = true
4516 dropdownHolderFrame.BackgroundColor3 = library.colors.topGradient
4517 colored[1 + #colored] = {dropdownHolderFrame, "BackgroundColor3", "topGradient"}
4518 dropdownHolderFrame.BorderColor3 = library.colors.elementBorder
4519 colored[1 + #colored] = {dropdownHolderFrame, "BorderColor3", "elementBorder"}
4520 dropdownHolderFrame.Position = UDim2.fromScale(0.025, 1.012)
4521 dropdownHolderFrame.Selectable = true
4522 dropdownHolderFrame.Size = UDim2.fromOffset(206, 22)
4523 dropdownHolderFrame.Visible = false
4524 dropdownHolderFrame.Image = "rbxassetid://2454009026"
4525 dropdownHolderFrame.ImageColor3 = library.colors.bottomGradient
4526 colored[1 + #colored] = {dropdownHolderFrame, "ImageColor3", "bottomGradient"}
4527 dropdownHolderInner.Name = "dropdownHolderInner"
4528 dropdownHolderInner.Parent = dropdownHolderFrame
4529 dropdownHolderInner.Active = true
4530 dropdownHolderInner.AnchorPoint = Vector2.new(0.5, 0.5)
4531 dropdownHolderInner.BackgroundColor3 = library.colors.topGradient
4532 colored[1 + #colored] = {dropdownHolderInner, "BackgroundColor3", "topGradient"}
4533 dropdownHolderInner.BorderColor3 = library.colors.elementBorder
4534 dropdownHolderInner.Position = UDim2.fromScale(0.5, 0.5)
4535 dropdownHolderInner.Selectable = true
4536 dropdownHolderInner.Size = UDim2.new(1, -4, 1, -4)
4537 dropdownHolderInner.Image = "rbxassetid://2454009026"
4538 dropdownHolderInner.ImageColor3 = library.colors.bottomGradient
4539 colored[1 + #colored] = {dropdownHolderInner, "ImageColor3", "bottomGradient"}
4540 realDropdownHolder.Name = "realDropdownHolder"
4541 realDropdownHolder.Parent = dropdownHolderInner
4542 realDropdownHolder.BackgroundColor3 = Color3.new(1, 1, 1)
4543 realDropdownHolder.BackgroundTransparency = 1
4544 realDropdownHolder.Selectable = false
4545 realDropdownHolder.Size = UDim2.fromScale(1, 1)
4546 realDropdownHolder.CanvasSize = UDim2.new()
4547 realDropdownHolder.ScrollBarThickness = 5
4548 realDropdownHolder.ScrollingDirection = Enum.ScrollingDirection.Y
4549 realDropdownHolder.AutomaticCanvasSize = Enum.AutomaticSize.Y
4550 realDropdownHolder.ScrollBarImageTransparency = 0.5
4551 realDropdownHolder.ScrollBarImageColor3 = library.colors.section
4552 colored[1 + #colored] = {realDropdownHolder, "ScrollBarImageColor3", "section"}
4553 realDropdownHolderList.Name = "realDropdownHolderList"
4554 realDropdownHolderList.Parent = realDropdownHolder
4555 realDropdownHolderList.HorizontalAlignment = Enum.HorizontalAlignment.Center
4556 realDropdownHolderList.SortOrder = Enum.SortOrder.LayoutOrder
4557 sectionFunctions:Update()
4558 local restorezindex = {}
4559 library.signals[1 + #library.signals] = newDropdown.MouseEnter:Connect(function()
4560 colored_dropdown_BackgroundColor3[3] = "main"
4561 colored_dropdown_BackgroundColor3[4] = 1.5
4562 colored_dropdown_ImageColor3[3] = "main"
4563 colored_dropdown_ImageColor3[4] = 2.5
4564 tweenService:Create(dropdown, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
4565 BackgroundColor3 = darkenColor(library.colors.main, 1.5),
4566 ImageColor3 = darkenColor(library.colors.main, 2.5)
4567 }):Play()
4568 end)
4569 library.signals[1 + #library.signals] = newDropdown.MouseLeave:Connect(function()
4570 if not dropdownEnabled then
4571 colored_dropdown_BackgroundColor3[3] = "topGradient"
4572 colored_dropdown_BackgroundColor3[4] = nil
4573 colored_dropdown_ImageColor3[3] = "bottomGradient"
4574 colored_dropdown_ImageColor3[4] = nil
4575 tweenService:Create(dropdown, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
4576 BackgroundColor3 = library.colors.topGradient,
4577 ImageColor3 = library.colors.bottomGradient
4578 }):Play()
4579 end
4580 end)
4581 local function UpdateDropdownHolder()
4582 if optionCount >= 6 then
4583 realDropdownHolder.CanvasSize = UDim2:fromOffset(realDropdownHolderList.AbsoluteContentSize.Y + 2)
4584 elseif optionCount <= 5 then
4585 dropdownHolderFrame.Size = UDim2.fromOffset(206, realDropdownHolderList.AbsoluteContentSize.Y + 4)
4586 end
4587 end
4588 local validate = nil
4589 local SetupValidation = nil
4590 do
4591 local Signals = {}
4592 local Setup = nil
4593 function SetupValidation()
4594 for k, v in next, Signals do
4595 v = v and v:Disconnect()
4596 Signals[k] = nil
4597 end
4598 if options.AutoValidate and list and (typeof(list) == "Instance") then
4599 local Val = library_flags[flagName] or selectedOption
4600 if multiselect then
4601 for _, v in next, Val do
4602 Setup(v)
4603 end
4604 else
4605 Setup(Val)
4606 end
4607 end
4608 end
4609 local gpcs = game.GetPropertyChangedSignal
4610 function Setup(v)
4611 if typeof(v) == "Instance" then
4612 local Signal = nil
4613 Signal = gpcs(v, "Parent"):Connect(function()
4614 if options.AutoValidate then
4615 if list and (v.Parent ~= list) then
4616 Signal = (Signal and Signal:Disconnect() and nil) or nil
4617 validate()
4618 end
4619 else
4620 for k, v in next, Signals do
4621 v = v and v:Disconnect()
4622 Signals[k] = nil
4623 end
4624 end
4625 end)
4626 end
4627 end
4628 end
4629 local function AddOptions(optionsTable, filter)
4630 if options.Sort then
4631 local didstuff, dosort = nil, options.Sort
4632 if type(dosort) == "function" then
4633 local g, h = pcall(table.sort, optionsTable, dosort)
4634 if g then
4635 didstuff = true
4636 elseif h then
4637 warn("Error sorting list:", h, debug.traceback(""))
4638 end
4639 end
4640 if not didstuff then
4641 table.sort(optionsTable, library.defaultSort)
4642 end
4643 end
4644 if blankstring and (optionsTable[1] ~= blankstring or table.find(optionsTable, blankstring, 2)) then
4645 local exists = table.find(optionsTable, blankstring)
4646 if exists then
4647 for _ = 1, 35 do
4648 table.remove(optionsTable, exists)
4649 exists = table.find(optionsTable, blankstring)
4650 if not exists then
4651 break
4652 end
4653 end
4654 end
4655 table.insert(optionsTable, 1, blankstring)
4656 end
4657 optionCount = 0
4658 realDropdownHolderList.Parent = nil
4659 realDropdownHolder:ClearAllChildren()
4660 realDropdownHolderList.Parent = realDropdownHolder
4661 for _, v in next, optionsTable do
4662 if not filter or tostring(v):lower():find(dropdownSelection.Text:lower(), 1, not options.RegEx) then
4663 optionCount = optionCount + 1
4664 UpdateDropdownHolder()
4665 local newOption = Instance_new("ImageLabel")
4666 local optionButton = Instance_new("TextButton")
4667 if selectedOption == v then
4668 selectedObjects[1] = newOption
4669 selectedObjects[2] = optionButton
4670 end
4671 newOption.Name = "Frame"
4672 newOption.Parent = realDropdownHolder
4673 local togged = (not multiselect and selectedOption == v) or (multiselect and table.find(selectedOption, v))
4674 newOption.BackgroundColor3 = (togged and library.colors.selectedOption) or library.colors.topGradient
4675 newOption.BorderSizePixel = 0
4676 newOption.Size = UDim2.fromOffset(202, 18)
4677 newOption.Image = "rbxassetid://2454009026"
4678 newOption.ImageColor3 = (togged and library.colors.unselectedOption) or library.colors.bottomGradient
4679 local stringed = tostring(v)
4680 optionButton.Name = stringed
4681 optionButton.Parent = newOption
4682 optionButton.Active = true
4683 optionButton.AnchorPoint = Vector2.new(0.5, 0.5)
4684 optionButton.BackgroundColor3 = Color3.new(1, 1, 1)
4685 optionButton.BackgroundTransparency = 1
4686 optionButton.Position = UDim2.fromScale(0.5, 0.5)
4687 optionButton.Selectable = true
4688 optionButton.Size = UDim2.new(1, -10, 1)
4689 optionButton.ZIndex = 5
4690 optionButton.Font = Enum.Font.Code
4691 optionButton.Text = (togged and (" " .. stringed)) or stringed
4692 optionButton.TextColor3 = (togged and library.colors.main) or library.colors.otherElementText
4693 optionButton.TextSize = 14
4694 optionButton.TextXAlignment = Enum.TextXAlignment.Left
4695 library.signals[1 + #library.signals] = optionButton[(multiselect and "MouseButton1Click") or "MouseButton1Down"]:Connect(function()
4696 if not library.colorpicker then
4697 dropdownSelection.Text = (passed_multiselect == "string" and multiselect) or tostring(blankstring or "Select Item(s)")
4698 restorezindex[newSection] = restorezindex[newSection] or newSection.ZIndex
4699 restorezindex[newDropdown] = restorezindex[newDropdown] or newDropdown.ZIndex
4700 restorezindex[sectionHolder] = restorezindex[sectionHolder] or sectionHolder.ZIndex
4701 if multiselect then
4702 local cloned = {unpack(selectedOption)}
4703 local togged = table.find(selectedOption, v)
4704 if togged then
4705 table.remove(selectedOption, togged)
4706 else
4707 selectedOption[1 + #selectedOption] = v
4708 end
4709 togged = table.find(selectedOption, v)
4710 optionButton.Text = (togged and (" " .. stringed)) or stringed
4711 newOption.BackgroundColor3 = (togged and library.colors.selectedOption) or library.colors.topGradient
4712 newOption.ImageColor3 = (togged and library.colors.unselectedOption) or library.colors.bottomGradient
4713 optionButton.TextColor3 = (togged and library.colors.main) or library.colors.otherElementText
4714 if callback then
4715 task.spawn(callback, selectedOption, cloned)
4716 end
4717 if togged then
4718 if addcallback then
4719 task.spawn(addcallback, v, selectedOption)
4720 end
4721 elseif delcallback then
4722 task.spawn(delcallback, v, selectedOption)
4723 end
4724 if modcallback then
4725 task.spawn(modcallback, v, togged, selectedOption)
4726 end
4727 if #selectedOption == 0 and clrcallback then
4728 task.spawn(clrcallback, selectedOption, cloned)
4729 end
4730 return
4731 else
4732 dropdownSelection.Text = stringed
4733 if selectedOption ~= v then
4734 local last_v = library_flags[flagName]
4735 do
4736 local First = selectedObjects[1]
4737 if First then
4738 selectedObjects[1].BackgroundColor3 = library.colors.topGradient
4739 selectedObjects[1].ImageColor3 = library.colors.bottomGradient
4740 end
4741 end
4742 do
4743 local Second = selectedObjects[2]
4744 if Second then
4745 selectedObjects[2].Text = selectedObjects[2].Name
4746 selectedObjects[2].TextColor3 = library.colors.otherElementText
4747 end
4748 end
4749 selectedOption = v
4750 selectedObjects[1] = newOption
4751 selectedObjects[2] = optionButton
4752 newOption.BackgroundColor3 = library.colors.selectedOption
4753 newOption.ImageColor3 = library.colors.unselectedOption
4754 optionButton.TextColor3 = library.colors.main
4755 dropdownHolderFrame.Visible = false
4756 dropdownToggle.Rotation = 90
4757 dropdownEnabled = false
4758 newDropdown.ZIndex = 1
4759 colored_dropdown_BackgroundColor3[3] = "topGradient"
4760 colored_dropdown_BackgroundColor3[4] = nil
4761 colored_dropdown_ImageColor3[3] = "bottomGradient"
4762 colored_dropdown_ImageColor3[4] = nil
4763 tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
4764 BackgroundColor3 = library.colors.topGradient,
4765 ImageColor3 = library.colors.bottomGradient
4766 }):Play()
4767 library_flags[flagName] = selectedOption
4768 if options.Location then
4769 options.Location[options.LocationFlag or flagName] = selectedOption
4770 end
4771 dropdownSelection.Text = tostring(selectedOption)
4772 if submenuOpen then
4773 submenuOpen = nil
4774 end
4775 if callback then
4776 task.spawn(callback, selectedOption, last_v)
4777 end
4778 else
4779 submenuOpen = nil
4780 dropdownToggle.Rotation = 90
4781 colored_dropdown_BackgroundColor3[3] = "topGradient"
4782 colored_dropdown_BackgroundColor3[4] = nil
4783 colored_dropdown_ImageColor3[3] = "bottomGradient"
4784 colored_dropdown_ImageColor3[4] = nil
4785 tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
4786 BackgroundColor3 = library.colors.topGradient,
4787 ImageColor3 = library.colors.bottomGradient
4788 }):Play()
4789 dropdownHolderFrame.Visible = false
4790 end
4791 end
4792 for ins, z in next, restorezindex do
4793 ins.ZIndex = z
4794 end
4795 end
4796 end)
4797 library.signals[1 + #library.signals] = optionButton.MouseEnter:Connect(function()
4798 tweenService:Create(newOption, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
4799 BackgroundColor3 = library.colors.hoveredOptionTop,
4800 ImageColor3 = library.colors.hoveredOptionBottom
4801 }):Play()
4802 end)
4803 library.signals[1 + #library.signals] = optionButton.MouseLeave:Connect(function()
4804 local togged = (not multiselect and selectedOption == v) or (multiselect and table.find(selectedOption, v))
4805 tweenService:Create(newOption, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
4806 BackgroundColor3 = (togged and library.colors.selectedOption) or library.colors.topGradient,
4807 ImageColor3 = (togged and library.colors.unselectedOption) or library.colors.bottomGradient
4808 }):Play()
4809 end)
4810 UpdateDropdownHolder()
4811 end
4812 end
4813 end
4814 local precisionscrolling, update = nil
4815 local showing = false
4816 local function display(dropdownEnabled, f)
4817 if submenuOpen == dropdown or submenuOpen == nil then
4818 if dropdownEnabled then
4819 list = resolvelist()
4820 if next(list) then
4821 else
4822 local EmptyVal = options.EmptyValue
4823 if EmptyVal ~= nil then
4824 table.insert(list, 1, EmptyVal)
4825 end
4826 end
4827 AddOptions(list, f)
4828 submenuOpen = dropdown
4829 dropdownToggle.Rotation = 270
4830 restorezindex[newSection] = restorezindex[newSection] or newSection.ZIndex
4831 restorezindex[newDropdown] = restorezindex[newDropdown] or newDropdown.ZIndex
4832 restorezindex[sectionHolder] = restorezindex[sectionHolder] or sectionHolder.ZIndex
4833 newSection.ZIndex = 50 + newSection.ZIndex
4834 newDropdown.ZIndex = 2
4835 sectionHolder.ZIndex = 2
4836 colored_dropdown_BackgroundColor3[3] = "main"
4837 colored_dropdown_BackgroundColor3[4] = 1.5
4838 colored_dropdown_ImageColor3[3] = "main"
4839 colored_dropdown_ImageColor3[4] = 2.5
4840 tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
4841 BackgroundColor3 = darkenColor(library.colors.main, 1.5),
4842 ImageColor3 = darkenColor(library.colors.main, 2.5)
4843 }):Play()
4844 dropdownHolderFrame.Visible = true
4845 if not options.DisablePrecisionScrolling then
4846 local scrollrate = tonumber(options.ScrollButtonRate or options.ScrollRate) or 5
4847 local upkey = options.ScrollUpButton or library.scrollupbutton or shared.scrollupbutton or Enum.KeyCode.Up
4848 local downkey = options.ScrollDownButton or library.scrolldownbutton or shared.scrolldownbutton or Enum.KeyCode.Down
4849 precisionscrolling = (precisionscrolling and precisionscrolling:Disconnect() and nil) or userInputService.InputBegan:Connect(function(input)
4850 if input.UserInputType == Enum.UserInputType.Keyboard then
4851 local code = input.KeyCode
4852 local isup = code == upkey
4853 local isdown = code == downkey
4854 if isup or isdown then
4855 local txt = userInputService:GetFocusedTextBox()
4856 if not txt or txt == dropdownSelection then
4857 while wait_check() and userInputService:IsKeyDown(code) do
4858 realDropdownHolder.CanvasPosition = Vector2:new(math.clamp(realDropdownHolder.CanvasPosition.Y + ((isup and -scrollrate) or scrollrate), 0, realDropdownHolder.AbsoluteCanvasSize.Y))
4859 end
4860 end
4861 end
4862 end
4863 end)
4864 library.signals[1 + #library.signals] = precisionscrolling
4865 end
4866 else
4867 submenuOpen = nil
4868 dropdownToggle.Rotation = 90
4869 colored_dropdown_BackgroundColor3[3] = "topGradient"
4870 colored_dropdown_BackgroundColor3[4] = nil
4871 colored_dropdown_ImageColor3[3] = "bottomGradient"
4872 colored_dropdown_ImageColor3[4] = nil
4873 tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
4874 BackgroundColor3 = library.colors.topGradient,
4875 ImageColor3 = library.colors.bottomGradient
4876 }):Play()
4877 dropdownHolderFrame.Visible = false
4878 for ins, z in next, restorezindex do
4879 ins.ZIndex = z
4880 end
4881 precisionscrolling = (precisionscrolling and precisionscrolling:Disconnect() and nil) or nil
4882 end
4883 end
4884 showing = dropdownEnabled
4885 if showing or dropdownEnabled then
4886 else
4887 delay(0.01, update)
4888 end
4889 end
4890 local Set = (multiselect and function(t, dat)
4891 if nil == dat and t ~= nil then
4892 dat = t
4893 end
4894 local lastv = library_flags[flagName]
4895 if not lastv or selectedOption ~= lastv then
4896 if lastv and type(lastv) == "table" then
4897 selectedOption = library_flags[flagName]
4898 else
4899 library_flags[flagName] = selectedOption
4900 end
4901 warn("Attempting to use new table for", flagName, " Please use :Set(), because setting it through flags table may cause errors", debug.traceback(""))
4902 lastv = library_flags[flagName]
4903 end
4904 local cloned = {unpack(selectedOption)}
4905 if not dat then
4906 if #selectedOption ~= 0 then
4907 table.clear(selectedOption)
4908 if callback then
4909 task.spawn(callback, selectedOption, cloned)
4910 end
4911 end
4912 return selectedOption
4913 elseif type(dat) ~= "table" then
4914 warn("Expected table for argument #1 on Set for MultiSelect searchbox. Got", dat, debug.traceback(""))
4915 return selectedOption
4916 end
4917 for k = table.pack(unpack(dat)).n, 1, -1 do
4918 if dat[k] == nil then
4919 table.remove(dat, k)
4920 end
4921 end
4922 local proceed = #cloned ~= #dat
4923 table.clear(selectedOption)
4924 for k, v in next, dat do
4925 selectedOption[k] = v
4926 if not proceed and cloned[k] ~= v then
4927 proceed = 1
4928 end
4929 end
4930 dropdownSelection.Text = (passed_multiselect == "string" and multiselect) or tostring(blankstring or "Select Item(s)")
4931 if proceed and callback then
4932 task.spawn(callback, selectedOption, cloned)
4933 end
4934 if options.AutoValidate then
4935 SetupValidation()
4936 end
4937 return selectedOption
4938 end) or function(t, str)
4939 if nil == str and t then
4940 str = t
4941 end
4942 local last_v = library_flags[flagName]
4943 selectedOption = str
4944 library_flags[flagName] = str
4945 if options.Location then
4946 options.Location[options.LocationFlag or flagName] = str
4947 end
4948 local sstr = (selectedOption and tostring(selectedOption)) or blankstring or "No Blank String"
4949 if dropdownSelection.Text ~= sstr then
4950 dropdownSelection.Text = sstr
4951 end
4952 if callback and (last_v ~= str or options.AllowDuplicateCalls) then
4953 task.spawn(callback, str, last_v)
4954 end
4955 if options.AutoValidate then
4956 SetupValidation()
4957 end
4958 return str
4959 end
4960 if val ~= nil then
4961 Set(val)
4962 else
4963 library_flags[flagName] = selectedOption
4964 if options.Location then
4965 options.Location[options.LocationFlag or flagName] = selectedOption
4966 end
4967 if options.AutoValidate then
4968 SetupValidation()
4969 end
4970 end
4971 library.signals[1 + #library.signals] = dropdownToggle.MouseButton1Click:Connect(function()
4972 showing = not showing
4973 display(showing)
4974 end)
4975 library.signals[1 + #library.signals] = dropdownSelection.Focused:Connect(function()
4976 showing = true
4977 display(true)
4978 end)
4979 library.signals[1 + #library.signals] = dropdownSelection:GetPropertyChangedSignal("Text"):Connect(function()
4980 if showing then
4981 display(true, #dropdownSelection.Text > 0)
4982 end
4983 end)
4984 if not multiselect then
4985 library.signals[1 + #library.signals] = dropdownSelection.FocusLost:Connect(function(b)
4986 if showing then
4987 wait()
4988 end
4989 showing = false
4990 display(false)
4991 if b then
4992 Set(dropdownSelection.Text)
4993 end
4994 end)
4995 end
4996 AddOptions(list)
4997 local default = library_flags[flagName]
4998 function update()
4999 dropdownName, callback = options.Name or dropdownName, options.Callback
5000 local sstr = (passed_multiselect == "string" and multiselect) or (not multiselect and library_flags[flagName] and tostring(library_flags[flagName])) or (not multiselect and selectedOption and tostring(selectedOption)) or blankstring or "Nothing"
5001 if dropdownSelection.Text ~= sstr then
5002 dropdownSelection.Text = sstr
5003 end
5004 dropdownHeadline.Text = (dropdownName and tostring(dropdownName)) or "???"
5005 return sstr
5006 end
5007 function validate(fallbackValue)
5008 if list and table.find(list, library_flags[flagName]) then
5009 update()
5010 return true
5011 end
5012 if fallbackValue ~= nil then
5013 if fallbackValue == "__DEFAULT" then
5014 fallbackValue = default
5015 end
5016 else
5017 fallbackValue = list[1]
5018 end
5019 if multiselect and type(fallbackValue) ~= "table" then
5020 fallbackValue = {fallbackValue}
5021 end
5022 return Set(fallbackValue)
5023 end
5024 local objectdata = {
5025 Options = options,
5026 Name = flagName,
5027 Flag = flagName,
5028 Type = "SearchBox",
5029 Default = default,
5030 Parent = sectionFunctions,
5031 Instance = dropdownSelection,
5032 Validate = validate,
5033 Set = Set,
5034 Remove = function()
5035 if newDropdown then
5036 newDropdown.Parent = nil
5037 sectionFunctions:Update()
5038 end
5039 end,
5040 RawSet = ((multiselect and function(t, dat)
5041 if nil == dat and t ~= nil then
5042 dat = t
5043 end
5044 local lastv = library_flags[flagName]
5045 if not lastv or selectedOption ~= lastv then
5046 if lastv and type(lastv) == "table" then
5047 selectedOption = library_flags[flagName]
5048 else
5049 library_flags[flagName] = selectedOption
5050 end
5051 warn("Attempting to use new table for", flagName, " Please use :Set(), as setting through flags table may cause errors", debug.traceback(""))
5052 lastv = library_flags[flagName]
5053 end
5054 local cloned = {unpack(selectedOption)}
5055 if not dat then
5056 if #selectedOption ~= 0 then
5057 table.clear(selectedOption)
5058 if callback then
5059 task.spawn(callback, selectedOption, cloned)
5060 end
5061 end
5062 return selectedOption
5063 elseif type(dat) ~= "table" then
5064 warn("Expected table for argument #1 on Set for MultiSelect searchbox. Got", dat, debug.traceback(""))
5065 return selectedOption
5066 end
5067 for k = table.pack(unpack(dat)).n, 1, -1 do
5068 if dat[k] == nil then
5069 table.remove(dat, k)
5070 end
5071 end
5072 local proceed = #cloned ~= #dat
5073 table.clear(selectedOption)
5074 for k, v in next, dat do
5075 selectedOption[k] = v
5076 if not proceed and cloned[k] ~= v then
5077 proceed = 1
5078 end
5079 end
5080 update()
5081 return selectedOption
5082 end) or function(t, str)
5083 if nil == str and t then
5084 str = t
5085 end
5086 selectedOption = str
5087 library_flags[flagName] = str
5088 if options.Location then
5089 options.Location[options.LocationFlag or flagName] = str
5090 end
5091 update()
5092 return str
5093 end),
5094 Get = function()
5095 return library_flags[flagName]
5096 end,
5097 Update = update,
5098 Reset = function()
5099 return Set(nil, default)
5100 end
5101 }
5102 function objectdata.UpdateList(t, listt, updateValues)
5103 if (nil == listt and t ~= nil) or (type(t) == "table" and type(listt) ~= "table") then
5104 listt, updateValues = t, listt
5105 end
5106 if listt == objectdata then
5107 listt = nil
5108 end
5109 resolvelist = getresolver(listt or options.List, options.Filter, options.Method)
5110 list = resolvelist()
5111 if next(list) then
5112 else
5113 local EmptyVal = options.EmptyValue
5114 if EmptyVal ~= nil then
5115 table.insert(list, 1, EmptyVal)
5116 end
5117 end
5118 if updateValues then
5119 validate()
5120 end
5121 if showing then
5122 display(false)
5123 display(true)
5124 end
5125 return list
5126 end
5127 tabFunctions.Flags[flagName], sectionFunctions.Flags[flagName], elements[flagName] = objectdata, objectdata, objectdata
5128 return objectdata
5129 end
5130 sectionFunctions.NewSearchBox = sectionFunctions.AddSearchBox
5131 sectionFunctions.CreateSearchBox = sectionFunctions.AddSearchBox
5132 sectionFunctions.SearchBox = sectionFunctions.AddSearchBox
5133 sectionFunctions.CreateSearchbox = sectionFunctions.AddSearchBox
5134 sectionFunctions.NewSearchbox = sectionFunctions.AddSearchBox
5135 sectionFunctions.Searchbox = sectionFunctions.AddSearchBox
5136 sectionFunctions.Sbox = sectionFunctions.AddSearchBox
5137 sectionFunctions.SBox = sectionFunctions.AddSearchBox
5138 if isfolder and makefolder and listfiles and readfile and writefile then
5139 function sectionFunctions:AddPersistence(options, ...)
5140 options = (options and type(options) == "string" and resolvevararg("Tab", options, ...)) or options
5141 local dropdownName, custom_workspace, val, persistiveflags, suffix, callback, loadcallback, savecallback, postload, postsave, flagName = assert(options.Name, "Missing Name for new persistence."), options.Workspace or library.WorkspaceName, options.Value, options.Persistive or options.Flags or "all", options.Suffix, options.Callback, options.LoadCallback, options.SaveCallback, options.PostLoadCallback, options.PostSaveCallback, options.Flag or (function()
5142 library.unnamedpersistence = 1 + (library.unnamedpersistence or 0)
5143 return "Persistence" .. tostring(library.unnamedpersistence)
5144 end)()
5145 if elements[flagName] ~= nil then
5146 warn(debug.traceback("Warning! Re-used flag '" .. flagName .. "'", 3))
5147 end
5148 local designerpersists = options.Desginer
5149 local newDropdown = Instance_new("Frame")
5150 local dropdown = Instance_new("ImageLabel")
5151 local dropdownInner = Instance_new("ImageLabel")
5152 local dropdownToggle = Instance_new("ImageButton")
5153 local dropdownSelection = Instance_new("TextBox")
5154 local dropdownHeadline = Instance_new("TextLabel")
5155 local dropdownHolderFrame = Instance_new("ImageLabel")
5156 local dropdownHolderInner = Instance_new("ImageLabel")
5157 local realDropdownHolder = Instance_new("ScrollingFrame")
5158 local realDropdownHolderList = Instance_new("UIListLayout")
5159 local dropdownEnabled = false
5160 if not isfolder("./Pepsi Lib") then
5161 makefolder("./Pepsi Lib")
5162 end
5163 local common_string = "./Pepsi Lib/" .. tostring(custom_workspace or library.WorkspaceName)
5164 local function resolvelist(nofold)
5165 if custom_workspace ~= options.Workspace then
5166 custom_workspace = options.Workspace
5167 common_string = "./Pepsi Lib/" .. tostring(custom_workspace or library.WorkspaceName)
5168 end
5169 if not isfolder or not makefolder or not listfiles then
5170 return {}
5171 end
5172 if not isfolder(common_string) then
5173 if nofold then
5174 return {}
5175 end
5176 makefolder(common_string)
5177 end
5178 assert(isfolder(common_string), "Couldn't create folder: " .. tostring(library.WorkspaceName or "No workspace name?"))
5179 local names, files = {}, listfiles(common_string)
5180 if #files > 0 then
5181 local len = #common_string + 2
5182 for _, f in next, files do
5183 names[1 + #names] = string.sub(f, len, -5)
5184 end
5185 table.sort(names)
5186 end
5187 return names
5188 end
5189 local list = resolvelist(true)
5190 local blankstring = options.BlankValue or options.NoValueString or options.Nothing
5191 local selectedObjects = {}
5192 local optionCount = 0
5193 if blankstring and val == nil then
5194 val = blankstring
5195 end
5196 local selectedOption = val or blankstring or list[1]
5197 newDropdown.Name = "newDropdown"
5198 newDropdown.Parent = sectionHolder
5199 newDropdown.BackgroundColor3 = Color3.new(1, 1, 1)
5200 newDropdown.BackgroundTransparency = 1
5201 newDropdown.Size = UDim2.new(1, 0, 0, 42)
5202 dropdown.Name = "dropdown"
5203 dropdown.Parent = newDropdown
5204 dropdown.Active = true
5205 dropdown.BackgroundColor3 = library.colors.topGradient
5206 local colored_dropdown_BackgroundColor3 = {dropdown, "BackgroundColor3", "topGradient"}
5207 colored[1 + #colored] = colored_dropdown_BackgroundColor3
5208 dropdown.BorderColor3 = library.colors.elementBorder
5209 colored[1 + #colored] = {dropdown, "BorderColor3", "elementBorder"}
5210 dropdown.Position = UDim2.fromScale(0.027, 0.45)
5211 dropdown.Selectable = true
5212 dropdown.Size = UDim2.fromOffset(206, 18)
5213 dropdown.Image = "rbxassetid://2454009026"
5214 dropdown.ImageColor3 = library.colors.bottomGradient
5215 local colored_dropdown_ImageColor3 = {dropdown, "ImageColor3", "bottomGradient"}
5216 colored[1 + #colored] = colored_dropdown_ImageColor3
5217 dropdownInner.Name = "dropdownInner"
5218 dropdownInner.Parent = dropdown
5219 dropdownInner.Active = true
5220 dropdownInner.AnchorPoint = Vector2.new(0.5, 0.5)
5221 dropdownInner.BackgroundColor3 = library.colors.topGradient
5222 colored[1 + #colored] = {dropdownInner, "BackgroundColor3", "topGradient"}
5223 dropdownInner.BorderColor3 = library.colors.elementBorder
5224 colored[1 + #colored] = {dropdownInner, "BorderColor3", "elementBorder"}
5225 dropdownInner.Position = UDim2.fromScale(0.5, 0.5)
5226 dropdownInner.Selectable = true
5227 dropdownInner.Size = UDim2.new(1, -4, 1, -4)
5228 dropdownInner.Image = "rbxassetid://2454009026"
5229 dropdownInner.ImageColor3 = library.colors.bottomGradient
5230 colored[1 + #colored] = {dropdownInner, "ImageColor3", "bottomGradient"}
5231 dropdownToggle.Name = "dropdownToggle"
5232 dropdownToggle.Parent = dropdown
5233 dropdownToggle.BackgroundColor3 = Color3.new(1, 1, 1)
5234 dropdownToggle.BackgroundTransparency = 1
5235 dropdownToggle.Position = UDim2.fromScale(0.9, 0.17)
5236 dropdownToggle.Rotation = 90
5237 dropdownToggle.Size = UDim2.fromOffset(12, 12)
5238 dropdownToggle.ZIndex = 2
5239 dropdownToggle.Image = "rbxassetid://71659683"
5240 dropdownToggle.ImageColor3 = Color3.fromRGB(171, 171, 171)
5241 dropdownSelection.Name = "dropdownSelection"
5242 dropdownSelection.Parent = dropdown
5243 dropdownSelection.BackgroundColor3 = Color3.new(1, 1, 1)
5244 dropdownSelection.BackgroundTransparency = 1
5245 dropdownSelection.Position = UDim2.new(0.0295485705)
5246 dropdownSelection.Size = UDim2.fromScale(0.97, 1)
5247 dropdownSelection.ZIndex = 5
5248 dropdownSelection.Font = Enum.Font.Code
5249 dropdownSelection.LineHeight = 1.15
5250 dropdownSelection.Text = (selectedOption and tostring(selectedOption)) or "nil"
5251 dropdownSelection.TextColor3 = library.colors.otherElementText
5252 colored[1 + #colored] = {dropdownSelection, "TextColor3", "otherElementText"}
5253 dropdownSelection.TextSize = 14
5254 dropdownSelection.TextXAlignment = Enum.TextXAlignment.Left
5255 dropdownHeadline.Name = "dropdownHeadline"
5256 dropdownHeadline.Parent = newDropdown
5257 dropdownHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
5258 dropdownHeadline.BackgroundTransparency = 1
5259 dropdownHeadline.Position = UDim2.fromScale(0.034, 0.03)
5260 dropdownHeadline.Size = UDim2.fromOffset(167, 11)
5261 dropdownHeadline.Font = Enum.Font.Code
5262 dropdownHeadline.Text = (dropdownName and tostring(dropdownName)) or "???"
5263 dropdownHeadline.TextColor3 = library.colors.elementText
5264 colored[1 + #colored] = {dropdownHeadline, "TextColor3", "elementText"}
5265 dropdownHeadline.TextSize = 14
5266 dropdownHeadline.TextXAlignment = Enum.TextXAlignment.Left
5267 dropdownHolderFrame.Name = "dropdownHolderFrame"
5268 dropdownHolderFrame.Parent = newDropdown
5269 dropdownHolderFrame.Active = true
5270 dropdownHolderFrame.BackgroundColor3 = library.colors.topGradient
5271 colored[1 + #colored] = {dropdownHolderFrame, "BackgroundColor3", "topGradient"}
5272 dropdownHolderFrame.BorderColor3 = library.colors.elementBorder
5273 colored[1 + #colored] = {dropdownHolderFrame, "BorderColor3", "elementBorder"}
5274 dropdownHolderFrame.Position = UDim2.fromScale(0.025, 1.012)
5275 dropdownHolderFrame.Selectable = true
5276 dropdownHolderFrame.Size = UDim2.fromOffset(206, 22)
5277 dropdownHolderFrame.Visible = false
5278 dropdownHolderFrame.Image = "rbxassetid://2454009026"
5279 dropdownHolderFrame.ImageColor3 = library.colors.bottomGradient
5280 colored[1 + #colored] = {dropdownHolderFrame, "ImageColor3", "bottomGradient"}
5281 dropdownHolderInner.Name = "dropdownHolderInner"
5282 dropdownHolderInner.Parent = dropdownHolderFrame
5283 dropdownHolderInner.Active = true
5284 dropdownHolderInner.AnchorPoint = Vector2.new(0.5, 0.5)
5285 dropdownHolderInner.BackgroundColor3 = library.colors.topGradient
5286 colored[1 + #colored] = {dropdownHolderInner, "BackgroundColor3", "topGradient"}
5287 dropdownHolderInner.BorderColor3 = library.colors.elementBorder
5288 colored[1 + #colored] = {dropdownHolderInner, "BorderColor3", "elementBorder"}
5289 dropdownHolderInner.Position = UDim2.fromScale(0.5, 0.5)
5290 dropdownHolderInner.Selectable = true
5291 dropdownHolderInner.Size = UDim2.new(1, -4, 1, -4)
5292 dropdownHolderInner.Image = "rbxassetid://2454009026"
5293 dropdownHolderInner.ImageColor3 = library.colors.bottomGradient
5294 colored[1 + #colored] = {dropdownHolderInner, "ImageColor3", "bottomGradient"}
5295 realDropdownHolder.Name = "realDropdownHolder"
5296 realDropdownHolder.Parent = dropdownHolderInner
5297 realDropdownHolder.BackgroundColor3 = Color3.new(1, 1, 1)
5298 realDropdownHolder.BackgroundTransparency = 1
5299 realDropdownHolder.Selectable = false
5300 realDropdownHolder.Size = UDim2.fromScale(1, 1)
5301 realDropdownHolder.CanvasSize = UDim2.new()
5302 realDropdownHolder.ScrollBarThickness = 5
5303 realDropdownHolder.ScrollingDirection = Enum.ScrollingDirection.Y
5304 realDropdownHolder.AutomaticCanvasSize = Enum.AutomaticSize.Y
5305 realDropdownHolder.ScrollBarImageTransparency = 0.5
5306 realDropdownHolder.ScrollBarImageColor3 = library.colors.section
5307 colored[1 + #colored] = {realDropdownHolder, "ScrollBarImageColor3", "section"}
5308 realDropdownHolderList.Name = "realDropdownHolderList"
5309 realDropdownHolderList.Parent = realDropdownHolder
5310 realDropdownHolderList.HorizontalAlignment = Enum.HorizontalAlignment.Center
5311 realDropdownHolderList.SortOrder = Enum.SortOrder.LayoutOrder
5312 sectionFunctions:Update()
5313 library.signals[1 + #library.signals] = newDropdown.MouseEnter:Connect(function()
5314 colored_dropdown_BackgroundColor3[3] = "main"
5315 colored_dropdown_BackgroundColor3[4] = 1.5
5316 colored_dropdown_ImageColor3[3] = "main"
5317 colored_dropdown_ImageColor3[4] = 2.5
5318 tweenService:Create(dropdown, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
5319 BackgroundColor3 = darkenColor(library.colors.main, 1.5),
5320 ImageColor3 = darkenColor(library.colors.main, 2.5)
5321 }):Play()
5322 end)
5323 library.signals[1 + #library.signals] = newDropdown.MouseLeave:Connect(function()
5324 if not dropdownEnabled then
5325 colored_dropdown_BackgroundColor3[3] = "topGradient"
5326 colored_dropdown_BackgroundColor3[4] = nil
5327 colored_dropdown_ImageColor3[3] = "bottomGradient"
5328 colored_dropdown_ImageColor3[4] = nil
5329 tweenService:Create(dropdown, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
5330 BackgroundColor3 = library.colors.topGradient,
5331 ImageColor3 = library.colors.bottomGradient
5332 }):Play()
5333 end
5334 end)
5335 local restorezindex = {}
5336 local function UpdateDropdownHolder()
5337 if optionCount >= 6 then
5338 realDropdownHolder.CanvasSize = UDim2:fromOffset(realDropdownHolderList.AbsoluteContentSize.Y + 2)
5339 elseif optionCount <= 5 then
5340 dropdownHolderFrame.Size = UDim2.fromOffset(206, (realDropdownHolderList.AbsoluteContentSize.Y + 4))
5341 end
5342 end
5343 local function AddOptions(optionsTable, filter)
5344 if options.Sort then
5345 local didstuff, dosort = nil, options.Sort
5346 if type(dosort) == "function" then
5347 local g, h = pcall(table.sort, optionsTable, dosort)
5348 if g then
5349 didstuff = true
5350 elseif h then
5351 warn("Error sorting list:", h, debug.traceback(""))
5352 end
5353 end
5354 if not didstuff then
5355 table.sort(optionsTable, library.defaultSort)
5356 end
5357 end
5358 if blankstring and (optionsTable[1] ~= blankstring or table.find(optionsTable, blankstring, 2)) then
5359 local exists = table.find(optionsTable, blankstring)
5360 if exists then
5361 for _ = 1, 35 do
5362 table.remove(optionsTable, exists)
5363 exists = table.find(optionsTable, blankstring)
5364 if not exists then
5365 break
5366 end
5367 end
5368 end
5369 table.insert(optionsTable, 1, blankstring)
5370 end
5371 optionCount = 0
5372 realDropdownHolderList.Parent = nil
5373 realDropdownHolder:ClearAllChildren()
5374 realDropdownHolderList.Parent = realDropdownHolder
5375 for _, v in next, optionsTable do
5376 if not filter or tostring(v):lower():find(dropdownSelection.Text:lower(), 1, true) then
5377 optionCount = optionCount + 1
5378 UpdateDropdownHolder()
5379 local newOption = Instance_new("ImageLabel")
5380 local optionButton = Instance_new("TextButton")
5381 if selectedOption == v or not selectedObjects[1] or not selectedObjects[2] then
5382 selectedObjects[1] = newOption
5383 selectedObjects[2] = optionButton
5384 end
5385 newOption.Name = "Frame"
5386 newOption.Parent = realDropdownHolder
5387 newOption.BackgroundColor3 = (selectedOption == v and library.colors.selectedOption or library.colors.topGradient)
5388 newOption.BorderSizePixel = 0
5389 newOption.Size = UDim2.fromOffset(202, 18)
5390 newOption.Image = "rbxassetid://2454009026"
5391 newOption.ImageColor3 = (selectedOption == v and library.colors.unselectedOption or library.colors.bottomGradient)
5392 optionButton.Name = tostring(v)
5393 optionButton.Parent = newOption
5394 optionButton.AnchorPoint = Vector2.new(0.5, 0.5)
5395 optionButton.BackgroundColor3 = Color3.new(1, 1, 1)
5396 optionButton.BackgroundTransparency = 1
5397 optionButton.Position = UDim2.fromScale(0.5, 0.5)
5398 optionButton.Size = UDim2.new(1, -10, 1)
5399 optionButton.ZIndex = 5
5400 optionButton.Font = Enum.Font.Code
5401 optionButton.Text = (selectedOption == v and " " .. tostring(v)) or tostring(v)
5402 optionButton.TextColor3 = (selectedOption == v and library.colors.main or library.colors.otherElementText)
5403 optionButton.TextSize = 14
5404 optionButton.TextXAlignment = Enum.TextXAlignment.Left
5405 library.signals[1 + #library.signals] = optionButton.MouseButton1Down:Connect(function()
5406 dropdownSelection.Text = tostring(v)
5407 restorezindex[newSection] = restorezindex[newSection] or newSection.ZIndex
5408 restorezindex[newDropdown] = restorezindex[newDropdown] or newDropdown.ZIndex
5409 restorezindex[sectionHolder] = restorezindex[sectionHolder] or sectionHolder.ZIndex
5410 if selectedOption ~= v then
5411 local last_v = library_flags[flagName]
5412 selectedObjects[1].BackgroundColor3 = library.colors.topGradient
5413 selectedObjects[1].ImageColor3 = library.colors.bottomGradient
5414 selectedObjects[2].Text = selectedObjects[2].Name
5415 selectedObjects[2].TextColor3 = library.colors.otherElementText
5416 selectedOption = v
5417 selectedObjects[1] = newOption
5418 selectedObjects[2] = optionButton
5419 newOption.BackgroundColor3 = library.colors.selectedOption
5420 newOption.ImageColor3 = library.colors.unselectedOption
5421 optionButton.TextColor3 = library.colors.main
5422 dropdownHolderFrame.Visible = false
5423 dropdownToggle.Rotation = 90
5424 dropdownEnabled = false
5425 colored_dropdown_BackgroundColor3[3] = "topGradient"
5426 colored_dropdown_BackgroundColor3[4] = nil
5427 colored_dropdown_ImageColor3[3] = "bottomGradient"
5428 colored_dropdown_ImageColor3[4] = nil
5429 tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
5430 BackgroundColor3 = library.colors.topGradient,
5431 ImageColor3 = library.colors.bottomGradient
5432 }):Play()
5433 library_flags[flagName] = selectedOption
5434 if options.Location then
5435 options.Location[options.LocationFlag or flagName] = selectedOption
5436 end
5437 dropdownSelection.Text = tostring(selectedOption)
5438 if submenuOpen then
5439 submenuOpen = nil
5440 end
5441 if callback then
5442 task.spawn(callback, selectedOption, last_v)
5443 end
5444 else
5445 submenuOpen = nil
5446 dropdownToggle.Rotation = 90
5447 newDropdown.ZIndex = 1
5448 sectionHolder.ZIndex = 1
5449 colored_dropdown_BackgroundColor3[3] = "topGradient"
5450 colored_dropdown_BackgroundColor3[4] = nil
5451 colored_dropdown_ImageColor3[3] = "bottomGradient"
5452 colored_dropdown_ImageColor3[4] = nil
5453 tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
5454 BackgroundColor3 = library.colors.topGradient,
5455 ImageColor3 = library.colors.bottomGradient
5456 }):Play()
5457 dropdownHolderFrame.Visible = false
5458 end
5459 for ins, z in next, restorezindex do
5460 ins.ZIndex = z
5461 end
5462 end)
5463 library.signals[1 + #library.signals] = optionButton.MouseEnter:Connect(function()
5464 tweenService:Create(newOption, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
5465 BackgroundColor3 = library.colors.hoveredOptionTop,
5466 ImageColor3 = library.colors.hoveredOptionBottom
5467 }):Play()
5468 end)
5469 library.signals[1 + #library.signals] = optionButton.MouseLeave:Connect(function()
5470 tweenService:Create(newOption, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
5471 BackgroundColor3 = library.colors.unhoveredOptionTop,
5472 ImageColor3 = library.colors.unhoveredOptionBottom
5473 }):Play()
5474 end)
5475 UpdateDropdownHolder()
5476 end
5477 end
5478 end
5479 local precisionscrolling, update = nil
5480 local showing = false
5481 local function display(dropdownEnabled, f)
5482 if submenuOpen == dropdown or submenuOpen == nil then
5483 if dropdownEnabled then
5484 list = resolvelist(true)
5485 AddOptions(list, f)
5486 submenuOpen = dropdown
5487 restorezindex[newSection] = restorezindex[newSection] or newSection.ZIndex
5488 restorezindex[newDropdown] = restorezindex[newDropdown] or newDropdown.ZIndex
5489 restorezindex[sectionHolder] = restorezindex[sectionHolder] or sectionHolder.ZIndex
5490 newSection.ZIndex = 50 + newSection.ZIndex
5491 dropdownToggle.Rotation = 270
5492 newDropdown.ZIndex = 2
5493 sectionHolder.ZIndex = 2
5494 colored_dropdown_BackgroundColor3[3] = "main"
5495 colored_dropdown_BackgroundColor3[4] = 1.5
5496 colored_dropdown_ImageColor3[3] = "main"
5497 colored_dropdown_ImageColor3[4] = 2.5
5498 tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
5499 BackgroundColor3 = darkenColor(library.colors.main, 1.5),
5500 ImageColor3 = darkenColor(library.colors.main, 2.5)
5501 }):Play()
5502 dropdownHolderFrame.Visible = true
5503 if not options.DisablePrecisionScrolling then
5504 local upkey = options.ScrollUpButton or library.scrollupbutton or shared.scrollupbutton or Enum.KeyCode.Up
5505 local downkey = options.ScrollDownButton or library.scrolldownbutton or shared.scrolldownbutton or Enum.KeyCode.Down
5506 precisionscrolling = (precisionscrolling and precisionscrolling:Disconnect() and nil) or userInputService.InputBegan:Connect(function(input)
5507 if input.UserInputType == Enum.UserInputType.Keyboard then
5508 local code = input.KeyCode
5509 local isup = code == upkey
5510 local isdown = code == downkey
5511 if isup or isdown then
5512 local txt = userInputService:GetFocusedTextBox()
5513 if not txt then
5514 while wait_check() and userInputService:IsKeyDown(code) do
5515 realDropdownHolder.CanvasPosition = Vector2:new(math.clamp(realDropdownHolder.CanvasPosition.Y + ((isup and -5) or 5), 0, realDropdownHolder.AbsoluteCanvasSize.Y))
5516 end
5517 end
5518 end
5519 end
5520 end)
5521 library.signals[1 + #library.signals] = precisionscrolling
5522 end
5523 else
5524 submenuOpen = nil
5525 dropdownToggle.Rotation = 90
5526 colored_dropdown_BackgroundColor3[3] = "topGradient"
5527 colored_dropdown_BackgroundColor3[4] = nil
5528 colored_dropdown_ImageColor3[3] = "bottomGradient"
5529 colored_dropdown_ImageColor3[4] = nil
5530 tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
5531 BackgroundColor3 = library.colors.topGradient,
5532 ImageColor3 = library.colors.bottomGradient
5533 }):Play()
5534 dropdownHolderFrame.Visible = false
5535 for ins, z in next, restorezindex do
5536 ins.ZIndex = z
5537 end
5538 precisionscrolling = (precisionscrolling and precisionscrolling:Disconnect() and nil) or nil
5539 end
5540 showing = dropdownEnabled
5541 if showing or dropdownEnabled then
5542 else
5543 delay(0.01, update)
5544 end
5545 end
5546 end
5547 local last_v = nil
5548 local function Set(t, str)
5549 if nil == str and t then
5550 str = t
5551 end
5552 selectedOption = str
5553 last_v = library_flags[flagName]
5554 library_flags[flagName] = str
5555 if options.Location then
5556 options.Location[options.LocationFlag or flagName] = str
5557 end
5558 local sstr = (selectedOption and tostring(selectedOption)) or blankstring or "No Blank String"
5559 if dropdownSelection.Text ~= sstr then
5560 dropdownSelection.Text = sstr
5561 end
5562 if callback and (last_v ~= str or options.AllowDuplicateCalls) then
5563 task.spawn(callback, str, last_v)
5564 end
5565 return str
5566 end
5567 if val ~= nil then
5568 Set(val)
5569 else
5570 Set("Filename")
5571 end
5572 library.signals[1 + #library.signals] = dropdownSelection.Focused:Connect(function()
5573 showing = true
5574 display(true)
5575 end)
5576 library.signals[1 + #library.signals] = dropdownSelection:GetPropertyChangedSignal("Text"):Connect(function()
5577 if showing then
5578 display(true, #dropdownSelection.Text > 0)
5579 end
5580 end)
5581 library.signals[1 + #library.signals] = dropdownSelection.FocusLost:Connect(function(b)
5582 if showing then
5583 wait()
5584 end
5585 showing = false
5586 display(false)
5587 if b then
5588 Set(dropdownSelection.Text)
5589 end
5590 end)
5591 AddOptions(list)
5592 local function savestuff(s, get)
5593 if not s or type(s) ~= "string" then
5594 s = nil
5595 end
5596 local rawfile = "json__save"
5597 if not get then
5598 local filenameddst = string.gsub(s or dropdownSelection.Text or "", "%W", "")
5599 if #filenameddst == 0 then
5600 return
5601 end
5602 rawfile = string.format("%s/%s.txt", common_string, filenameddst)
5603 end
5604 if savecallback then
5605 local x, e = pcall(savecallback, rawfile, library_flags[flagName])
5606 if not x and e then
5607 warn("Error while calling the Pre-Save callback:", e, debug.traceback(""))
5608 end
5609 end
5610 local working_with = {}
5611 if persistiveflags == 1 or persistiveflags == true or persistiveflags == "*" then
5612 persistiveflags = "all"
5613 elseif persistiveflags == 2 then
5614 persistiveflags = "tab"
5615 elseif persistiveflags == 3 then
5616 persistiveflags = "section"
5617 end
5618 if persistiveflags == "all" or persistiveflags == "tab" or persistiveflags == "section" then
5619 for cflag, data in next, (persistiveflags == "all" and elements) or (persistiveflags == "tab" and tabFunctions.Flags) or (persistiveflags == "section" and sectionFunctions.Flags) do
5620 if data.Type ~= "Persistence" and (designerpersists or string.sub(cflag, 1, 11) ~= "__Designer.") then
5621 working_with[cflag] = data
5622 end
5623 end
5624 elseif type(persistiveflags) == "table" then
5625 if #persistiveflags > 0 then
5626 local inverted = persistiveflags[0] == false or persistiveflags.Inverted
5627 for k, cflag in next, persistiveflags do
5628 if k > 0 then
5629 local data = elements[cflag]
5630 if data and data.Type ~= "Persistence" and (designerpersists or string.sub(cflag, 1, 11) ~= "__Designer.") then
5631 working_with[cflag] = (not inverted and data) or nil
5632 end
5633 end
5634 end
5635 else
5636 for cflag, persists in next, elements do
5637 if persists and (designerpersists or string.sub(cflag, 1, 11) ~= "__Designer.") then
5638 local data = elements[cflag]
5639 if data then
5640 working_with[cflag] = data
5641 end
5642 end
5643 end
5644 end
5645 end
5646 local saving = {}
5647 for cflag in next, working_with do
5648 local value = library_flags[cflag]
5649 local good, jval = nil, nil
5650 if value ~= nil then
5651 good, jval = JSONEncode(value)
5652 else
5653 good, jval = true, "null"
5654 end
5655 if not good or (jval == "null" and value ~= nil) then
5656 local typ = typeof(value)
5657 if typ == "Color3" then
5658 value = (library.rainbowflags[cflag] and "rainbow") or Color3ToHex(value)
5659 end
5660 value = tostring(value)
5661 good, jval = JSONEncode(value)
5662 if not good or (jval == "null" and value ~= nil) then
5663 warn("Could not save value:", value, debug.traceback(""))
5664 end
5665 end
5666 if good and jval then
5667 saving[cflag] = value
5668 end
5669 end
5670 local ret = nil
5671 local good, content = JSONEncode(saving)
5672 if good and content then
5673 if not get then
5674 if not isfolder(common_string) then
5675 makefolder(common_string)
5676 end
5677 writefile(rawfile, content)
5678 else
5679 ret = content
5680 end
5681 end
5682 if postsave then
5683 local x, e = pcall(postsave, rawfile, library_flags[flagName])
5684 if not x and e then
5685 warn("Error while calling the Post-Save callback:", e, debug.traceback(""))
5686 end
5687 end
5688 return ret
5689 end
5690 local function loadstuff(s, jsonmode, silent)
5691 if not s or type(s) ~= "string" then
5692 s = nil
5693 end
5694 local filename = "json__load"
5695 if not jsonmode then
5696 local filenameddst = convertfilename(s or dropdownSelection.Text, nil, "")
5697 if #filenameddst == 0 then
5698 return
5699 end
5700 filename = string.format("%s/%s.txt", common_string, filenameddst)
5701 end
5702 if loadcallback then
5703 local x, e = pcall(loadcallback, (jsonmode and s) or filename, library_flags[flagName])
5704 if not x and e then
5705 warn("Error while calling the Pre-Load callback:", e, debug.traceback(""))
5706 end
5707 end
5708 if jsonmode or not isfile or isfile(filename) then
5709 local content = (jsonmode and s) or (not jsonmode and readfile(filename))
5710 if content and #content > 1 then
5711 local good, jcontent = JSONDecode(content)
5712 if good and jcontent then
5713 for cflag, val in next, jcontent do
5714 if val and type(val) == "string" and #val > 7 and #val < 64 and string.sub(val, 1, 5) == "Enum." then
5715 local e = string.find(val, ".", 6, true)
5716 if e then
5717 local en = Enum[string.sub(val, 6, e - 1)]
5718 en = en and en[string.sub(val, e + 1)]
5719 if en then
5720 val = en
5721 else
5722 warn("Tried & failed to convert '" .. val .. "' to EnumItem")
5723 end
5724 end
5725 end
5726 local data = elements[cflag]
5727 if data and data.Type ~= "Persistence" then
5728 if silent and data.RawSet then
5729 data:RawSet(val)
5730 elseif data.Set then
5731 data:Set(val)
5732 else
5733 library_flags[cflag] = val
5734 end
5735 end
5736 end
5737 end
5738 end
5739 end
5740 if postload then
5741 local x, e = pcall(postload, filename, library_flags[flagName])
5742 if not x and e then
5743 warn("Error while calling the Post-Load callback:", e, debug.traceback(""))
5744 end
5745 end
5746 end
5747 local fram = nil
5748 do
5749 local buttons, offset = {}, 0
5750 for _, options in next, {{
5751 Name = "Save" .. ((suffix and (" " .. tostring(suffix))) or ""),
5752 Callback = savestuff
5753 }, {
5754 Name = "Load" .. ((suffix and (" " .. tostring(suffix))) or ""),
5755 Callback = loadstuff
5756 }} do
5757 local buttonName, callback = options.Name, options.Callback
5758 local realButton = Instance_new("TextButton")
5759 realButton.Name = "realButton"
5760 realButton.BackgroundColor3 = Color3.new(1, 1, 1)
5761 realButton.BackgroundTransparency = 1
5762 realButton.Size = UDim2.fromScale(1, 1)
5763 realButton.ZIndex = 5
5764 realButton.Font = Enum.Font.Code
5765 realButton.Text = (buttonName and tostring(buttonName)) or "???"
5766 realButton.TextColor3 = library.colors.elementText
5767 colored[1 + #colored] = {realButton, "TextColor3", "elementText"}
5768 realButton.TextSize = 14
5769 local textsize = textToSize(realButton).X + 14
5770 if newSection.Parent and (newSection.Parent.AbsoluteSize.X < (offset + textsize + 8)) then
5771 offset, fram = 0, nil
5772 end
5773 local newButton = fram or Instance_new("Frame")
5774 fram = newButton
5775 local button = Instance_new("ImageLabel")
5776 newButton.Name = removeSpaces((buttonName and buttonName:lower() or "???") .. "Holder")
5777 newButton.Parent = sectionHolder
5778 newButton.BackgroundColor3 = Color3.new(1, 1, 1)
5779 newButton.BackgroundTransparency = 1
5780 newButton.Size = UDim2.new(1, 0, 0, 24)
5781 button.Name = "button"
5782 button.Parent = newButton
5783 button.Active = true
5784 button.BackgroundColor3 = library.colors.topGradient
5785 local colored_button_BackgroundColor3 = {button, "BackgroundColor3", "topGradient"}
5786 colored[1 + #colored] = colored_button_BackgroundColor3
5787 button.BorderColor3 = library.colors.elementBorder
5788 colored[1 + #colored] = {button, "BorderColor3", "elementBorder"}
5789 button.Position = UDim2.new(0.031, offset, 0.166)
5790 button.Selectable = true
5791 button.Size = UDim2.fromOffset(28, 18)
5792 button.Image = "rbxassetid://2454009026"
5793 button.ImageColor3 = library.colors.bottomGradient
5794 local colored_button_ImageColor3 = {button, "ImageColor3", "bottomGradient"}
5795 colored[1 + #colored] = colored_button_ImageColor3
5796 local buttonInner = Instance_new("ImageLabel")
5797 buttonInner.Name = "buttonInner"
5798 buttonInner.Parent = button
5799 buttonInner.Active = true
5800 buttonInner.AnchorPoint = Vector2.new(0.5, 0.5)
5801 buttonInner.BackgroundColor3 = library.colors.topGradient
5802 colored[1 + #colored] = {buttonInner, "BackgroundColor3", "topGradient"}
5803 buttonInner.BorderColor3 = library.colors.elementBorder
5804 colored[1 + #colored] = {buttonInner, "BorderColor3", "elementBorder"}
5805 buttonInner.Position = UDim2.fromScale(0.5, 0.5)
5806 buttonInner.Selectable = true
5807 buttonInner.Size = UDim2.new(1, -4, 1, -4)
5808 buttonInner.Image = "rbxassetid://2454009026"
5809 buttonInner.ImageColor3 = library.colors.bottomGradient
5810 colored[1 + #colored] = {buttonInner, "ImageColor3", "bottomGradient"}
5811 button.Size = UDim2.fromOffset(textsize, 18)
5812 realButton.Parent = button
5813 offset = offset + textsize + 6
5814 sectionFunctions:Update()
5815 local presses = 0
5816 library.signals[1 + #library.signals] = realButton.MouseButton1Click:Connect(function()
5817 if not library.colorpicker and not submenuOpen then
5818 presses = 1 + presses
5819 task.spawn(callback, presses)
5820 end
5821 end)
5822 library.signals[1 + #library.signals] = button.MouseEnter:Connect(function()
5823 colored_button_BackgroundColor3[3] = "main"
5824 colored_button_BackgroundColor3[4] = 1.5
5825 colored_button_ImageColor3[3] = "main"
5826 colored_button_ImageColor3[4] = 2.5
5827 tweenService:Create(button, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
5828 BackgroundColor3 = darkenColor(library.colors.main, 1.5),
5829 ImageColor3 = darkenColor(library.colors.main, 2.5)
5830 }):Play()
5831 end)
5832 library.signals[1 + #library.signals] = button.MouseLeave:Connect(function()
5833 colored_button_BackgroundColor3[3] = "topGradient"
5834 colored_button_BackgroundColor3[4] = nil
5835 colored_button_ImageColor3[3] = "bottomGradient"
5836 colored_button_ImageColor3[4] = nil
5837 tweenService:Create(button, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
5838 BackgroundColor3 = library.colors.topGradient,
5839 ImageColor3 = library.colors.bottomGradient
5840 }):Play()
5841 end)
5842 end
5843 end
5844 local default = library_flags[flagName]
5845 function update()
5846 dropdownName, custom_workspace, persistiveflags, suffix, callback, loadcallback, savecallback, postload, postsave = options.Name or dropdownName, options.Workspace or library.WorkspaceName, options.Persistive or options.Flags or "all", options.Suffix, options.Callback, options.LoadCallback, options.SaveCallback, options.PostLoadCallback, options.PostSaveCallback
5847 local sstr = tostring(library_flags[flagName])
5848 if dropdownSelection.Text ~= sstr then
5849 dropdownSelection.Text = sstr
5850 end
5851 dropdownHeadline.Text = (dropdownName and tostring(dropdownName)) or "???"
5852 return sstr
5853 end
5854 local objectdata = {
5855 Options = options,
5856 Name = flagName,
5857 Flag = flagName,
5858 Type = "Persistence",
5859 Default = default,
5860 Parent = sectionFunctions,
5861 Instance = dropdownSelection,
5862 Set = Set,
5863 Remove = function()
5864 local relod = nil
5865 if newDropdown then
5866 newDropdown.Parent = nil
5867 relod = true
5868 end
5869 if fram then
5870 fram.Parent = nil
5871 relod = true
5872 end
5873 if relod then
5874 sectionFunctions:Update()
5875 end
5876 end,
5877 SaveFile = function(t, str, ret)
5878 if t ~= nil and type(t) ~= "table" then
5879 str, ret = t, str
5880 end
5881 if type(str) == "string" then
5882 str = str:match("(.+)%..+$") or str
5883 end
5884 return savestuff(str, ret)
5885 end,
5886 LoadFile = function(t, str, jsonmode)
5887 if t ~= nil and type(t) ~= "table" then
5888 str, jsonmode = t, str
5889 end
5890 if isfile and isfile(str) then
5891 return loadstuff(readfile(str), true)
5892 elseif not jsonmode and type(str) == "string" then
5893 str = str:match("(.+)%..+$") or str
5894 end
5895 return loadstuff(str, jsonmode)
5896 end,
5897 LoadJSON = function(_, json)
5898 return loadstuff(json, true)
5899 end,
5900 LoadFileRaw = function(t, str, jsonmode)
5901 if t ~= nil and type(t) ~= "table" then
5902 str, jsonmode = t, str
5903 end
5904 if isfile and isfile(str) then
5905 return loadstuff(readfile(str), true, true)
5906 elseif not jsonmode and type(str) == "string" then
5907 str = str:match("(.+)%..+$") or str
5908 end
5909 return loadstuff(str, jsonmode, true)
5910 end,
5911 LoadJSONRaw = function(_, json)
5912 return loadstuff(json, true, true)
5913 end,
5914 GetJSON = function(t, clipboard)
5915 if nil == clipboard and t ~= nil then
5916 clipboard = t
5917 end
5918 local json = savestuff(nil, true)
5919 local clipfunc = (clipboard and type(clipboard) == "function" and clipboard) or setclipboard
5920 if clipboard and clipfunc then
5921 clipfunc(json)
5922 end
5923 return json
5924 end,
5925 RawSet = function(t, str)
5926 if nil == str and t ~= nil then
5927 str = t
5928 end
5929 selectedOption = str
5930 last_v = library_flags[flagName]
5931 library_flags[flagName] = str
5932 if options.Location then
5933 options.Location[options.LocationFlag or flagName] = str
5934 end
5935 update()
5936 return str
5937 end,
5938 Get = function()
5939 return library_flags[flagName]
5940 end,
5941 Update = update,
5942 Reset = function()
5943 return Set(nil, default)
5944 end
5945 }
5946 tabFunctions.Flags[flagName], sectionFunctions.Flags[flagName], elements[flagName] = objectdata, objectdata, objectdata
5947 return objectdata
5948 end
5949 else
5950 function sectionFunctions.AddPersistence()
5951 if not library.warnedpersistance then
5952 library.warnedpersistance = 1
5953 warn(debug.traceback("Persistance not supported"))
5954 end
5955 function sectionFunctions.AddPersistence()
5956 end
5957 end
5958 end
5959 sectionFunctions.NewPersistence = sectionFunctions.AddPersistence
5960 sectionFunctions.CreatePersistence = sectionFunctions.AddPersistence
5961 sectionFunctions.Persistence = sectionFunctions.AddPersistence
5962 sectionFunctions.CreateSaveLoad = sectionFunctions.AddPersistence
5963 sectionFunctions.SaveLoad = sectionFunctions.AddPersistence
5964 sectionFunctions.SL = sectionFunctions.AddPersistence
5965 function sectionFunctions:AddDropdown(options, ...)
5966 options = (options and type(options) == "string" and resolvevararg("Dropdown", options, ...)) or options
5967 local dropdownName, listt, val, callback, flagName = assert(options.Name, "Missing Name for new searchbox."), assert(options.List, "Missing List for new searchbox."), options.Value, options.Callback, options.Flag or (function()
5968 library.unnameddropdown = 1 + (library.unnameddropdown or 0)
5969 return "Dropdown" .. tostring(library.unnameddropdown)
5970 end)()
5971 if elements[flagName] ~= nil then
5972 warn(debug.traceback("Warning! Re-used flag '" .. flagName .. "'", 3))
5973 end
5974 local newDropdown = Instance_new("Frame")
5975 local dropdown = Instance_new("ImageLabel")
5976 local dropdownInner = Instance_new("ImageLabel")
5977 local dropdownToggle = Instance_new("ImageButton")
5978 local dropdownSelection = Instance_new("TextLabel")
5979 local dropdownHeadline = Instance_new("TextLabel")
5980 local dropdownHolderFrame = Instance_new("ImageLabel")
5981 local dropdownHolderInner = Instance_new("ImageLabel")
5982 local realDropdownHolder = Instance_new("ScrollingFrame")
5983 local realDropdownHolderList = Instance_new("UIListLayout")
5984 local dropdownEnabled = false
5985 local multiselect = options.MultiSelect or options.Multi or options.Multiple
5986 local addcallback = options.ItemAdded or options.AddedCallback
5987 local delcallback = options.ItemRemoved or options.RemovedCallback
5988 local clrcallback = options.ItemsCleared or options.ClearedCallback
5989 local modcallback = options.ItemChanged or options.ChangedCallback
5990 local blankstring = not multiselect and (options.BlankValue or options.NoValueString or options.Nothing)
5991 local resolvelist = getresolver(listt, options.Filter, options.Method)
5992 local list = resolvelist()
5993 if next(list) then
5994 else
5995 local EmptyVal = options.EmptyValue
5996 if EmptyVal ~= nil then
5997 table.insert(list, 1, EmptyVal)
5998 end
5999 end
6000 local selectedOption = list[1]
6001 local passed_multiselect = multiselect and type(multiselect)
6002 if blankstring and val == nil then
6003 val = blankstring
6004 end
6005 if val ~= nil then
6006 selectedOption = val
6007 end
6008 if multiselect and (not selectedOption or type(selectedOption) ~= "table") then
6009 selectedOption = {}
6010 end
6011 local selectedObjects = {}
6012 local optionCount = 0
6013 newDropdown.Name = "newDropdown"
6014 newDropdown.Parent = sectionHolder
6015 newDropdown.BackgroundColor3 = Color3.new(1, 1, 1)
6016 newDropdown.BackgroundTransparency = 1
6017 newDropdown.Size = UDim2.new(1, 0, 0, 42)
6018 dropdown.Name = "dropdown"
6019 dropdown.Parent = newDropdown
6020 dropdown.Active = true
6021 dropdown.BackgroundColor3 = library.colors.topGradient
6022 local colored_dropdown_BackgroundColor3 = {dropdown, "BackgroundColor3", "topGradient"}
6023 colored[1 + #colored] = colored_dropdown_BackgroundColor3
6024 dropdown.BorderColor3 = library.colors.elementBorder
6025 colored[1 + #colored] = {dropdown, "BorderColor3", "elementBorder"}
6026 dropdown.Position = UDim2.fromScale(0.027, 0.45)
6027 dropdown.Selectable = true
6028 dropdown.Size = UDim2.fromOffset(206, 18)
6029 dropdown.Image = "rbxassetid://2454009026"
6030 dropdown.ImageColor3 = library.colors.bottomGradient
6031 local colored_dropdown_ImageColor3 = {dropdown, "ImageColor3", "bottomGradient"}
6032 colored[1 + #colored] = colored_dropdown_ImageColor3
6033 dropdownInner.Name = "dropdownInner"
6034 dropdownInner.Parent = dropdown
6035 dropdownInner.Active = true
6036 dropdownInner.AnchorPoint = Vector2.new(0.5, 0.5)
6037 dropdownInner.BackgroundColor3 = library.colors.topGradient
6038 colored[1 + #colored] = {dropdownInner, "BackgroundColor3", "topGradient"}
6039 dropdownInner.BorderColor3 = library.colors.elementBorder
6040 colored[1 + #colored] = {dropdownInner, "BorderColor3", "elementBorder"}
6041 dropdownInner.Position = UDim2.fromScale(0.5, 0.5)
6042 dropdownInner.Selectable = true
6043 dropdownInner.Size = UDim2.new(1, -4, 1, -4)
6044 dropdownInner.Image = "rbxassetid://2454009026"
6045 dropdownInner.ImageColor3 = library.colors.bottomGradient
6046 colored[1 + #colored] = {dropdownInner, "ImageColor3", "bottomGradient"}
6047 dropdownToggle.Name = "dropdownToggle"
6048 dropdownToggle.Parent = dropdown
6049 dropdownToggle.BackgroundColor3 = Color3.new(1, 1, 1)
6050 dropdownToggle.BackgroundTransparency = 1
6051 dropdownToggle.Position = UDim2.fromScale(0.9, 0.17)
6052 dropdownToggle.Rotation = 90
6053 dropdownToggle.Size = UDim2.fromOffset(12, 12)
6054 dropdownToggle.ZIndex = 2
6055 dropdownToggle.Image = "rbxassetid://71659683"
6056 dropdownToggle.ImageColor3 = Color3.fromRGB(171, 171, 171)
6057 dropdownSelection.Name = "dropdownSelection"
6058 dropdownSelection.Parent = dropdown
6059 dropdownSelection.Active = true
6060 dropdownSelection.BackgroundColor3 = Color3.new(1, 1, 1)
6061 dropdownSelection.BackgroundTransparency = 1
6062 dropdownSelection.Position = UDim2.new(0.0295)
6063 dropdownSelection.Selectable = true
6064 dropdownSelection.Size = UDim2.fromScale(0.97, 1)
6065 dropdownSelection.ZIndex = 5
6066 dropdownSelection.Font = Enum.Font.Code
6067 dropdownSelection.Text = (passed_multiselect == "string" and multiselect) or (multiselect and tostring(blankstring or "Select Item(s)")) or (selectedOption and tostring(selectedOption)) or tostring(blankstring or "No Blank String")
6068 dropdownSelection.TextColor3 = library.colors.otherElementText
6069 colored[1 + #colored] = {dropdownSelection, "TextColor3", "otherElementText"}
6070 dropdownSelection.TextSize = 14
6071 dropdownSelection.TextXAlignment = Enum.TextXAlignment.Left
6072 dropdownHeadline.Name = "dropdownHeadline"
6073 dropdownHeadline.Parent = newDropdown
6074 dropdownHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
6075 dropdownHeadline.BackgroundTransparency = 1
6076 dropdownHeadline.Position = UDim2.fromScale(0.034, 0.03)
6077 dropdownHeadline.Size = UDim2.fromOffset(167, 11)
6078 dropdownHeadline.Font = Enum.Font.Code
6079 dropdownHeadline.Text = (dropdownName and tostring(dropdownName)) or "???"
6080 dropdownHeadline.TextColor3 = library.colors.elementText
6081 colored[1 + #colored] = {dropdownHeadline, "TextColor3", "elementText"}
6082 dropdownHeadline.TextSize = 14
6083 dropdownHeadline.TextXAlignment = Enum.TextXAlignment.Left
6084 dropdownHolderFrame.Name = "dropdownHolderFrame"
6085 dropdownHolderFrame.Parent = newDropdown
6086 dropdownHolderFrame.Active = true
6087 dropdownHolderFrame.BackgroundColor3 = library.colors.topGradient
6088 colored[1 + #colored] = {dropdownHolderFrame, "BackgroundColor3", "topGradient"}
6089 dropdownHolderFrame.BorderColor3 = library.colors.elementBorder
6090 colored[1 + #colored] = {dropdownHolderFrame, "BorderColor3", "elementBorder"}
6091 dropdownHolderFrame.Position = UDim2.fromScale(0.025, 1.012)
6092 dropdownHolderFrame.Selectable = true
6093 dropdownHolderFrame.Size = UDim2.fromOffset(206, 22)
6094 dropdownHolderFrame.Visible = false
6095 dropdownHolderFrame.Image = "rbxassetid://2454009026"
6096 dropdownHolderFrame.ImageColor3 = library.colors.bottomGradient
6097 colored[1 + #colored] = {dropdownHolderFrame, "ImageColor3", "bottomGradient"}
6098 dropdownHolderInner.Name = "dropdownHolderInner"
6099 dropdownHolderInner.Parent = dropdownHolderFrame
6100 dropdownHolderInner.Active = true
6101 dropdownHolderInner.AnchorPoint = Vector2.new(0.5, 0.5)
6102 dropdownHolderInner.BackgroundColor3 = library.colors.topGradient
6103 colored[1 + #colored] = {dropdownHolderInner, "BackgroundColor3", "topGradient"}
6104 dropdownHolderInner.BorderColor3 = library.colors.elementBorder
6105 colored[1 + #colored] = {dropdownHolderInner, "BorderColor3", "elementBorder"}
6106 dropdownHolderInner.Position = UDim2.fromScale(0.5, 0.5)
6107 dropdownHolderInner.Selectable = true
6108 dropdownHolderInner.Size = UDim2.new(1, -4, 1, -4)
6109 dropdownHolderInner.Image = "rbxassetid://2454009026"
6110 dropdownHolderInner.ImageColor3 = library.colors.bottomGradient
6111 colored[1 + #colored] = {dropdownHolderInner, "ImageColor3", "bottomGradient"}
6112 realDropdownHolder.Name = "realDropdownHolder"
6113 realDropdownHolder.Parent = dropdownHolderInner
6114 realDropdownHolder.BackgroundColor3 = Color3.new(1, 1, 1)
6115 realDropdownHolder.BackgroundTransparency = 1
6116 realDropdownHolder.Selectable = false
6117 realDropdownHolder.Size = UDim2.fromScale(1, 1)
6118 realDropdownHolder.CanvasSize = UDim2.new()
6119 realDropdownHolder.ScrollBarThickness = 5
6120 realDropdownHolder.ScrollingDirection = Enum.ScrollingDirection.Y
6121 realDropdownHolder.AutomaticCanvasSize = Enum.AutomaticSize.Y
6122 realDropdownHolder.ScrollBarImageTransparency = 0.5
6123 realDropdownHolder.ScrollBarImageColor3 = library.colors.section
6124 colored[1 + #colored] = {realDropdownHolder, "ScrollBarImageColor3", "section"}
6125 realDropdownHolderList.Name = "realDropdownHolderList"
6126 realDropdownHolderList.Parent = realDropdownHolder
6127 realDropdownHolderList.HorizontalAlignment = Enum.HorizontalAlignment.Center
6128 realDropdownHolderList.SortOrder = Enum.SortOrder.LayoutOrder
6129 sectionFunctions:Update()
6130 local showing = false
6131 local function UpdateDropdownHolder()
6132 if optionCount >= 6 then
6133 realDropdownHolder.CanvasSize = UDim2:fromOffset(realDropdownHolderList.AbsoluteContentSize.Y + 2)
6134 elseif optionCount <= 5 then
6135 dropdownHolderFrame.Size = UDim2.fromOffset(206, realDropdownHolderList.AbsoluteContentSize.Y + 4)
6136 end
6137 end
6138 local validate = nil
6139 local SetupValidation = nil
6140 do
6141 local Signals = {}
6142 local Setup = nil
6143 function SetupValidation()
6144 for k, v in next, Signals do
6145 v = v and v:Disconnect()
6146 Signals[k] = nil
6147 end
6148 if options.AutoValidate and list and (typeof(list) == "Instance") then
6149 local Val = library_flags[flagName] or selectedOption
6150 if multiselect then
6151 for _, v in next, Val do
6152 Setup(v)
6153 end
6154 else
6155 Setup(Val)
6156 end
6157 end
6158 end
6159 local gpcs = game.GetPropertyChangedSignal
6160 function Setup(v)
6161 if typeof(v) == "Instance" then
6162 local Signal = nil
6163 Signal = gpcs(v, "Parent"):Connect(function()
6164 if options.AutoValidate then
6165 if list and (v.Parent ~= list) then
6166 Signal = (Signal and Signal:Disconnect() and nil) or nil
6167 validate()
6168 end
6169 else
6170 for k, v in next, Signals do
6171 v = v and v:Disconnect()
6172 Signals[k] = nil
6173 end
6174 end
6175 end)
6176 end
6177 end
6178 end
6179 local restorezindex = {}
6180 local Set = (multiselect and function(t, dat)
6181 if nil == dat and t ~= nil then
6182 dat = t
6183 end
6184 local lastv = library_flags[flagName]
6185 if not lastv or selectedOption ~= lastv then
6186 if lastv and type(lastv) == "table" then
6187 selectedOption = library_flags[flagName]
6188 else
6189 library_flags[flagName] = selectedOption
6190 end
6191 warn("Attempting to use new table for", flagName, " Please use :Set(), as setting through flags table may cause errors", debug.traceback(""))
6192 lastv = library_flags[flagName]
6193 end
6194 local cloned = {unpack(selectedOption)}
6195 if not dat then
6196 if #selectedOption ~= 0 then
6197 table.clear(selectedOption)
6198 if callback then
6199 task.spawn(callback, selectedOption, cloned)
6200 end
6201 end
6202 return selectedOption
6203 elseif type(dat) ~= "table" then
6204 warn("Expected table for argument #1 on Set for MultiSelect dropdown. Got", dat, debug.traceback(""))
6205 return selectedOption
6206 end
6207 for k = table.pack(unpack(dat)).n, 1, -1 do
6208 if dat[k] == nil then
6209 table.remove(dat, k)
6210 end
6211 end
6212 local proceed = #cloned ~= #dat
6213 table.clear(selectedOption)
6214 for k, v in next, dat do
6215 selectedOption[k] = v
6216 if not proceed and cloned[k] ~= v then
6217 proceed = 1
6218 end
6219 end
6220 dropdownSelection.Text = (passed_multiselect == "string" and multiselect) or tostring(blankstring or "Select Item(s)")
6221 if proceed and callback then
6222 task.spawn(callback, selectedOption, cloned)
6223 end
6224 if options.AutoValidate then
6225 SetupValidation()
6226 end
6227 return selectedOption
6228 end) or function(t, str)
6229 if nil == str and t ~= nil then
6230 str = t
6231 end
6232 local last_v = library_flags[flagName]
6233 selectedOption = str
6234 library_flags[flagName] = str
6235 if options.Location then
6236 options.Location[options.LocationFlag or flagName] = str
6237 end
6238 local sstr = (selectedOption and tostring(selectedOption)) or blankstring or "No Blank String"
6239 if dropdownSelection.Text ~= sstr then
6240 dropdownSelection.Text = sstr
6241 end
6242 if callback and (last_v ~= str or options.AllowDuplicateCalls) then
6243 task.spawn(callback, str, last_v)
6244 end
6245 if options.AutoValidate then
6246 SetupValidation()
6247 end
6248 return str
6249 end
6250 if val ~= nil then
6251 Set(val)
6252 else
6253 library_flags[flagName] = selectedOption
6254 if options.Location then
6255 options.Location[options.LocationFlag or flagName] = selectedOption
6256 end
6257 if options.AutoValidate then
6258 SetupValidation()
6259 end
6260 end
6261 local function AddOptions(optionsTable)
6262 if options.Sort then
6263 local didstuff, dosort = nil, options.Sort
6264 if type(dosort) == "function" then
6265 local g, h = pcall(table.sort, optionsTable, dosort)
6266 if g then
6267 didstuff = true
6268 elseif h then
6269 warn("Error sorting list:", h, debug.traceback(""))
6270 end
6271 elseif (dosort ~= 1) and (dosort ~= true) then
6272 warn("Potential mistake for passed Sort argument:", dosort, debug.traceback(""))
6273 end
6274 if not didstuff then
6275 table.sort(optionsTable, library.defaultSort)
6276 end
6277 end
6278 if blankstring and ((optionsTable[1] ~= blankstring) or table.find(optionsTable, blankstring, 2)) then
6279 local exists = table.find(optionsTable, blankstring)
6280 if exists then
6281 for _ = 1, 35 do
6282 table.remove(optionsTable, exists)
6283 exists = table.find(optionsTable, blankstring)
6284 if not exists then
6285 break
6286 end
6287 end
6288 end
6289 table.insert(optionsTable, 1, blankstring)
6290 end
6291 optionCount = 0
6292 realDropdownHolderList.Parent = nil
6293 realDropdownHolder:ClearAllChildren()
6294 realDropdownHolderList.Parent = realDropdownHolder
6295 for _, v in next, optionsTable do
6296 optionCount = optionCount + 1
6297 local newOption = Instance_new("ImageLabel")
6298 local optionButton = Instance_new("TextButton")
6299 if selectedOption == v then
6300 selectedObjects[1] = newOption
6301 selectedObjects[2] = optionButton
6302 end
6303 newOption.Name = "Frame"
6304 newOption.Parent = realDropdownHolder
6305 local togged = (not multiselect and selectedOption == v) or (multiselect and table.find(selectedOption, v))
6306 newOption.BackgroundColor3 = (togged and library.colors.selectedOption) or library.colors.topGradient
6307 newOption.BorderSizePixel = 0
6308 newOption.Size = UDim2.fromOffset(202, 18)
6309 newOption.Image = "rbxassetid://2454009026"
6310 newOption.ImageColor3 = (togged and library.colors.unselectedOption) or library.colors.bottomGradient
6311 local stringed = tostring(v)
6312 optionButton.Name = stringed
6313 optionButton.Parent = newOption
6314 optionButton.AnchorPoint = Vector2.new(0.5, 0.5)
6315 optionButton.BackgroundColor3 = Color3.new(1, 1, 1)
6316 optionButton.BackgroundTransparency = 1
6317 optionButton.Position = UDim2.fromScale(0.5, 0.5)
6318 optionButton.Size = UDim2.new(1, -10, 1)
6319 optionButton.ZIndex = 5
6320 optionButton.Font = Enum.Font.Code
6321 optionButton.Text = (togged and (" " .. stringed)) or stringed
6322 optionButton.TextColor3 = (togged and library.colors.main) or library.colors.otherElementText
6323 optionButton.TextSize = 14
6324 optionButton.TextXAlignment = Enum.TextXAlignment.Left
6325 library.signals[1 + #library.signals] = optionButton.MouseButton1Click:Connect(function()
6326 if not library.colorpicker then
6327 restorezindex[newSection] = restorezindex[newSection] or newSection.ZIndex
6328 restorezindex[newDropdown] = restorezindex[newDropdown] or newDropdown.ZIndex
6329 restorezindex[sectionHolder] = restorezindex[sectionHolder] or sectionHolder.ZIndex
6330 if multiselect then
6331 local cloned = {unpack(selectedOption)}
6332 local togged = table.find(selectedOption, v)
6333 if togged then
6334 table.remove(selectedOption, togged)
6335 else
6336 selectedOption[1 + #selectedOption] = v
6337 end
6338 togged = table.find(selectedOption, v)
6339 optionButton.Text = (togged and (" " .. stringed)) or stringed
6340 newOption.BackgroundColor3 = (togged and library.colors.selectedOption) or library.colors.topGradient
6341 newOption.ImageColor3 = (togged and library.colors.unselectedOption) or library.colors.bottomGradient
6342 optionButton.TextColor3 = (togged and library.colors.main) or library.colors.otherElementText
6343 dropdownSelection.Text = (passed_multiselect == "string" and multiselect) or tostring(blankstring or "Select Item(s)")
6344 if callback then
6345 task.spawn(callback, selectedOption, cloned)
6346 end
6347 if togged then
6348 if addcallback then
6349 task.spawn(addcallback, v, selectedOption)
6350 end
6351 elseif delcallback then
6352 task.spawn(delcallback, v, selectedOption)
6353 end
6354 if modcallback then
6355 task.spawn(modcallback, v, togged, selectedOption)
6356 end
6357 if #selectedOption == 0 and clrcallback then
6358 task.spawn(clrcallback, selectedOption, cloned)
6359 end
6360 return
6361 else
6362 if selectedOption ~= v then
6363 local last_v = library_flags[flagName]
6364 selectedObjects[1].BackgroundColor3 = library.colors.topGradient
6365 selectedObjects[1].ImageColor3 = library.colors.bottomGradient
6366 selectedObjects[2].Text = selectedObjects[2].Name
6367 selectedObjects[2].TextColor3 = library.colors.otherElementText
6368 selectedOption = v
6369 dropdownSelection.Text = stringed
6370 selectedObjects[1] = newOption
6371 selectedObjects[2] = optionButton
6372 newOption.BackgroundColor3 = library.colors.selectedOption
6373 newOption.ImageColor3 = library.colors.unselectedOption
6374 optionButton.Text = " " .. stringed
6375 optionButton.TextColor3 = library.colors.main
6376 dropdownHolderFrame.Visible = false
6377 dropdownToggle.Rotation = 90
6378 dropdownEnabled = false
6379 newDropdown.ZIndex = 1
6380 colored_dropdown_BackgroundColor3[3] = "topGradient"
6381 colored_dropdown_BackgroundColor3[4] = nil
6382 colored_dropdown_ImageColor3[3] = "bottomGradient"
6383 colored_dropdown_ImageColor3[4] = nil
6384 tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
6385 BackgroundColor3 = library.colors.topGradient,
6386 ImageColor3 = library.colors.bottomGradient
6387 }):Play()
6388 library_flags[flagName] = selectedOption
6389 if options.Location then
6390 options.Location[options.LocationFlag or flagName] = selectedOption
6391 end
6392 submenuOpen = nil
6393 showing = false
6394 if callback then
6395 task.spawn(callback, selectedOption, last_v)
6396 end
6397 else
6398 showing = false
6399 submenuOpen = nil
6400 dropdownToggle.Rotation = 90
6401 newDropdown.ZIndex = 1
6402 sectionHolder.ZIndex = 1
6403 colored_dropdown_BackgroundColor3[3] = "topGradient"
6404 colored_dropdown_BackgroundColor3[4] = nil
6405 colored_dropdown_ImageColor3[3] = "bottomGradient"
6406 colored_dropdown_ImageColor3[4] = nil
6407 tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
6408 BackgroundColor3 = library.colors.topGradient,
6409 ImageColor3 = library.colors.bottomGradient
6410 }):Play()
6411 dropdownHolderFrame.Visible = false
6412 end
6413 end
6414 for ins, z in next, restorezindex do
6415 ins.ZIndex = z
6416 end
6417 end
6418 end)
6419 library.signals[1 + #library.signals] = optionButton.MouseEnter:Connect(function()
6420 tweenService:Create(newOption, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
6421 BackgroundColor3 = library.colors.hoveredOptionTop,
6422 ImageColor3 = library.colors.hoveredOptionBottom
6423 }):Play()
6424 end)
6425 library.signals[1 + #library.signals] = optionButton.MouseLeave:Connect(function()
6426 local togged = (not multiselect and selectedOption == v) or (multiselect and table.find(selectedOption, v))
6427 tweenService:Create(newOption, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
6428 BackgroundColor3 = (togged and library.colors.selectedOption) or library.colors.topGradient,
6429 ImageColor3 = (togged and library.colors.unselectedOption) or library.colors.bottomGradient
6430 }):Play()
6431 end)
6432 UpdateDropdownHolder()
6433 end
6434 end
6435 local precisionscrolling, update = nil
6436 local function display(dropdownEnabled)
6437 list = resolvelist()
6438 if next(list) then
6439 else
6440 local EmptyVal = options.EmptyValue
6441 if EmptyVal ~= nil then
6442 table.insert(list, 1, EmptyVal)
6443 end
6444 end
6445 if dropdownEnabled then
6446 AddOptions(list)
6447 submenuOpen = dropdown
6448 dropdownToggle.Rotation = 270
6449 restorezindex[newSection] = restorezindex[newSection] or newSection.ZIndex
6450 restorezindex[newDropdown] = restorezindex[newDropdown] or newDropdown.ZIndex
6451 restorezindex[sectionHolder] = restorezindex[sectionHolder] or sectionHolder.ZIndex
6452 newSection.ZIndex = 50 + newSection.ZIndex
6453 newDropdown.ZIndex = 2
6454 sectionHolder.ZIndex = 2
6455 colored_dropdown_BackgroundColor3[3] = "main"
6456 colored_dropdown_BackgroundColor3[4] = 1.5
6457 colored_dropdown_ImageColor3[3] = "main"
6458 colored_dropdown_ImageColor3[4] = 2.5
6459 tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
6460 BackgroundColor3 = darkenColor(library.colors.main, 1.5),
6461 ImageColor3 = darkenColor(library.colors.main, 2.5)
6462 }):Play()
6463 dropdownHolderFrame.Visible = true
6464 if not options.DisablePrecisionScrolling then
6465 local upkey = options.ScrollUpButton or library.scrollupbutton or shared.scrollupbutton or Enum.KeyCode.Up
6466 local downkey = options.ScrollDownButton or library.scrolldownbutton or shared.scrolldownbutton or Enum.KeyCode.Down
6467 precisionscrolling = (precisionscrolling and precisionscrolling:Disconnect() and nil) or userInputService.InputBegan:Connect(function(input)
6468 if input.UserInputType == Enum.UserInputType.Keyboard then
6469 local code = input.KeyCode
6470 local isup = code == upkey
6471 local isdown = code == downkey
6472 if isup or isdown then
6473 local txt = userInputService:GetFocusedTextBox()
6474 if not txt or txt == dropdownSelection then
6475 while wait_check() and userInputService:IsKeyDown(code) do
6476 realDropdownHolder.CanvasPosition = Vector2:new(math.clamp(realDropdownHolder.CanvasPosition.Y + ((isup and -5) or 5), 0, realDropdownHolder.AbsoluteCanvasSize.Y))
6477 end
6478 end
6479 end
6480 end
6481 end)
6482 library.signals[1 + #library.signals] = precisionscrolling
6483 end
6484 else
6485 submenuOpen = nil
6486 dropdownToggle.Rotation = 90
6487 colored_dropdown_BackgroundColor3[3] = "topGradient"
6488 colored_dropdown_BackgroundColor3[4] = nil
6489 colored_dropdown_ImageColor3[3] = "bottomGradient"
6490 colored_dropdown_ImageColor3[4] = nil
6491 tweenService:Create(dropdown, TweenInfo.new(0.35, library.configuration.easingStyle, library.configuration.easingDirection), {
6492 BackgroundColor3 = library.colors.topGradient,
6493 ImageColor3 = library.colors.bottomGradient
6494 }):Play()
6495 dropdownHolderFrame.Visible = false
6496 for ins, z in next, restorezindex do
6497 ins.ZIndex = z
6498 end
6499 precisionscrolling = (precisionscrolling and precisionscrolling:Disconnect() and nil) or nil
6500 end
6501 if not multiselect and (not next(list) or not table.find(list, library_flags[flagName])) then
6502 Set(list[1])
6503 end
6504 showing = dropdownEnabled
6505 if showing or dropdownEnabled then
6506 else
6507 delay(0.01, update)
6508 end
6509 end
6510 library.signals[1 + #library.signals] = newDropdown.InputEnded:Connect(function(input)
6511 if not library.colorpicker and input.UserInputType == Enum.UserInputType.MouseButton1 then
6512 showing = not showing
6513 display(showing)
6514 end
6515 end)
6516 library.signals[1 + #library.signals] = newDropdown.MouseEnter:Connect(function()
6517 colored_dropdown_BackgroundColor3[3] = "main"
6518 colored_dropdown_BackgroundColor3[4] = 1.5
6519 colored_dropdown_ImageColor3[3] = "main"
6520 colored_dropdown_ImageColor3[4] = 2.5
6521 tweenService:Create(dropdown, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
6522 BackgroundColor3 = darkenColor(library.colors.main, 1.5),
6523 ImageColor3 = darkenColor(library.colors.main, 2.5)
6524 }):Play()
6525 end)
6526 library.signals[1 + #library.signals] = newDropdown.MouseLeave:Connect(function()
6527 if not dropdownEnabled then
6528 colored_dropdown_BackgroundColor3[3] = "topGradient"
6529 colored_dropdown_BackgroundColor3[4] = nil
6530 colored_dropdown_ImageColor3[3] = "bottomGradient"
6531 colored_dropdown_ImageColor3[4] = nil
6532 tweenService:Create(dropdown, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
6533 BackgroundColor3 = library.colors.topGradient,
6534 ImageColor3 = library.colors.bottomGradient
6535 }):Play()
6536 end
6537 end)
6538 library.signals[1 + #library.signals] = dropdownToggle.MouseButton1Click:Connect(function()
6539 if not library.colorpicker then
6540 showing = not showing
6541 display(showing)
6542 end
6543 end)
6544 AddOptions(list)
6545 local default = library_flags[flagName]
6546 function update()
6547 dropdownName, callback = options.Name or dropdownName, options.Callback
6548 local sstr = (passed_multiselect == "string" and multiselect) or (library_flags[flagName] and tostring(library_flags[flagName])) or (selectedOption and tostring(selectedOption)) or blankstring or "nil"
6549 if dropdownSelection.Text ~= sstr then
6550 dropdownSelection.Text = sstr
6551 end
6552 dropdownHeadline.Text = (dropdownName and tostring(dropdownName)) or "???"
6553 return sstr
6554 end
6555 function validate(fallbackValue)
6556 if list and table.find(list, library_flags[flagName]) then
6557 update()
6558 return true
6559 end
6560 if fallbackValue ~= nil then
6561 if fallbackValue == "__DEFAULT" then
6562 fallbackValue = fallbackValue
6563 end
6564 else
6565 fallbackValue = list[1]
6566 end
6567 return Set((multiselect and {fallbackValue}) or fallbackValue)
6568 end
6569 local objectdata = {
6570 Options = options,
6571 Name = flagName,
6572 Flag = flagName,
6573 Type = "Dropdown",
6574 Default = default,
6575 Parent = sectionFunctions,
6576 Instance = dropdownSelection,
6577 Get = function()
6578 return library_flags[flagName]
6579 end,
6580 Set = Set,
6581 Remove = function()
6582 if newDropdown then
6583 newDropdown.Parent = nil
6584 sectionFunctions:Update()
6585 end
6586 end,
6587 RawSet = ((multiselect and function(t, dat)
6588 if nil == dat and t ~= nil then
6589 dat = t
6590 end
6591 local lastv = library_flags[flagName]
6592 if not lastv or selectedOption ~= lastv then
6593 if lastv and type(lastv) == "table" then
6594 selectedOption = library_flags[flagName]
6595 else
6596 library_flags[flagName] = selectedOption
6597 end
6598 warn("Attempting to use new table for", flagName, " Please use :Set(), as setting through flags table may cause errors", debug.traceback(""))
6599 lastv = library_flags[flagName]
6600 end
6601 local cloned = {unpack(selectedOption)}
6602 if not dat then
6603 if #selectedOption ~= 0 then
6604 table.clear(selectedOption)
6605 end
6606 return selectedOption
6607 elseif type(dat) ~= "table" then
6608 warn("Expected table for argument #1 on Set for MultiSelect dropdown. Got", dat, debug.traceback(""))
6609 return selectedOption
6610 end
6611 for k = table.pack(unpack(dat)).n, 1, -1 do
6612 if dat[k] == nil then
6613 table.remove(dat, k)
6614 end
6615 end
6616 table.clear(selectedOption)
6617 for k, v in next, dat do
6618 selectedOption[k] = v
6619 end
6620 return selectedOption
6621 end) or function(t, str)
6622 if nil == str and t ~= nil then
6623 str = t
6624 end
6625 selectedOption = str
6626 library_flags[flagName] = str
6627 if options.Location then
6628 options.Location[options.LocationFlag or flagName] = str
6629 end
6630 update()
6631 return str
6632 end),
6633 Update = update,
6634 Reset = function()
6635 return Set(nil, default)
6636 end
6637 }
6638 function objectdata.UpdateList(t, listt, updateValues)
6639 if (nil == listt and t ~= nil) or (type(t) == "table" and type(listt) ~= "table") then
6640 listt, updateValues = t, listt
6641 end
6642 if listt == objectdata then
6643 listt = nil
6644 end
6645 resolvelist = getresolver(listt or options.List, options.Filter, options.Method)
6646 list = resolvelist()
6647 if next(list) then
6648 else
6649 local EmptyVal = options.EmptyValue
6650 if EmptyVal ~= nil then
6651 table.insert(list, 1, EmptyVal)
6652 end
6653 end
6654 if updateValues then
6655 validate()
6656 end
6657 if showing then
6658 display(false)
6659 display(true)
6660 end
6661 return list
6662 end
6663 tabFunctions.Flags[flagName], sectionFunctions.Flags[flagName], elements[flagName] = objectdata, objectdata, objectdata
6664 return objectdata
6665 end
6666 sectionFunctions.AddDropDown = sectionFunctions.AddDropdown
6667 sectionFunctions.NewDropDown = sectionFunctions.AddDropdown
6668 sectionFunctions.NewDropdown = sectionFunctions.AddDropdown
6669 sectionFunctions.CreateDropdown = sectionFunctions.AddDropdown
6670 sectionFunctions.CreateDropdown = sectionFunctions.AddDropdown
6671 sectionFunctions.DropDown = sectionFunctions.AddDropdown
6672 sectionFunctions.Dropdown = sectionFunctions.AddDropdown
6673 sectionFunctions.DD = sectionFunctions.AddDropdown
6674 sectionFunctions.Dd = sectionFunctions.AddDropdown
6675 function sectionFunctions:AddColorpicker(options, ...)
6676 options = (options and type(options) == "string" and resolvevararg("Colorpicker", options, ...)) or options
6677 if options.Random == true then
6678 options.Value = "random"
6679 elseif options.Rainbow == true then
6680 options.Value = "rainbow"
6681 end
6682 local colorPickerName, presetColor, callback, flagName = assert(options.Name, "Missing Name for new colorpicker."), options.Value, options.Callback, options.Flag or (function()
6683 library.unnamedcolorpicker = 1 + (library.unnamedcolorpicker or 0)
6684 return "Colorpicker" .. tostring(library.unnamedcolorpicker)
6685 end)()
6686 if elements[flagName] ~= nil then
6687 warn(debug.traceback("Warning! Re-used flag '" .. flagName .. "'", 3))
6688 end
6689 local designers = options.__designer
6690 options.__designer = nil
6691 local rainbowColorMode = false
6692 if presetColor == "random" then
6693 presetColor = Color3.new(math.random(), math.random(), math.random())
6694 elseif presetColor == "rainbow" then
6695 presetColor = Color3.new(1, 1, 1)
6696 rainbowColorMode = true
6697 end
6698 local newColorPicker = Instance_new("Frame")
6699 local colorPicker = Instance_new("ImageLabel")
6700 local colorPickerInner = Instance_new("ImageLabel")
6701 local colorPickerHeadline = Instance_new("TextLabel")
6702 local colorPickerButton = Instance_new("TextButton")
6703 local colorPickerHolderFrame = Instance_new("ImageLabel")
6704 local colorPickerHolderInner = Instance_new("ImageLabel")
6705 local color = Instance_new("ImageLabel")
6706 local selectorColor = Instance_new("Frame")
6707 local hue = Instance_new("ImageLabel")
6708 local hueGradient = Instance_new("UIGradient")
6709 local selectorHue = Instance_new("Frame")
6710 local randomColor = Instance_new("ImageLabel")
6711 local randomColorInner = Instance_new("ImageLabel")
6712 local randomColorButton = Instance_new("ImageButton")
6713 local hexInputBox = Instance_new("TextBox")
6714 local hexInput = Instance_new("ImageLabel")
6715 local hexInputInner = Instance_new("ImageLabel")
6716 local rainbow = Instance_new("ImageLabel")
6717 local rainbowInner = Instance_new("ImageLabel")
6718 local rainbowButton = Instance_new("ImageButton")
6719 local startingColor = presetColor or Color3.new(1, 1, 1)
6720 local colorPickerEnabled = false
6721 local colorH, colorS, colorV = 1, 1, 1
6722 local colorInput, hueInput = nil, nil
6723 local oldBackgroundColor = Color3.new()
6724 local oldImageColor = oldBackgroundColor
6725 local oldColor = oldBackgroundColor
6726 local rainbowColorValue = 0
6727 newColorPicker.Name = "newColorPicker"
6728 newColorPicker.Parent = sectionHolder
6729 newColorPicker.BackgroundColor3 = Color3.new(1, 1, 1)
6730 newColorPicker.BackgroundTransparency = 1
6731 newColorPicker.Size = UDim2.new(1, 0, 0, 19)
6732 colorPicker.Name = "colorPicker"
6733 colorPicker.Parent = newColorPicker
6734 colorPicker.Active = true
6735 colorPicker.BackgroundColor3 = library.colors.topGradient
6736 local colored_colorPicker_BackgroundColor3 = {colorPicker, "BackgroundColor3", "topGradient"}
6737 colored[1 + #colored] = colored_colorPicker_BackgroundColor3
6738 colorPicker.BorderColor3 = library.colors.elementBorder
6739 colored[1 + #colored] = {colorPicker, "BorderColor3", "elementBorder"}
6740 colorPicker.Position = UDim2.fromScale(0.842, 0.113)
6741 colorPicker.Selectable = true
6742 colorPicker.Size = UDim2.fromOffset(24, 12)
6743 colorPicker.Image = "rbxassetid://2454009026"
6744 colorPicker.ImageColor3 = library.colors.bottomGradient
6745 local colored_colorPicker_ImageColor3 = {colorPicker, "ImageColor3", "bottomGradient"}
6746 colored[1 + #colored] = colored_colorPicker_ImageColor3
6747 colorPickerInner.Name = "colorPickerInner"
6748 colorPickerInner.Parent = colorPicker
6749 colorPickerInner.Active = true
6750 colorPickerInner.AnchorPoint = Vector2.new(0.5, 0.5)
6751 colorPickerInner.BorderColor3 = library.colors.elementBorder
6752 colored[1 + #colored] = {colorPickerInner, "BorderColor3", "elementBorder"}
6753 colorPickerInner.Position = UDim2.fromScale(0.5, 0.5)
6754 colorPickerInner.Selectable = true
6755 colorPickerInner.Size = UDim2.new(1, -4, 1, -4)
6756 colorPickerInner.Image = "rbxassetid://2454009026"
6757 colorPickerInner.BackgroundColor3 = darkenColor(startingColor, 1.5)
6758 colorPickerInner.ImageColor3 = darkenColor(startingColor, 2.5)
6759 colorPickerHeadline.Name = "colorPickerHeadline"
6760 colorPickerHeadline.Parent = newColorPicker
6761 colorPickerHeadline.BackgroundColor3 = Color3.new(1, 1, 1)
6762 colorPickerHeadline.BackgroundTransparency = 1
6763 colorPickerHeadline.Position = UDim2.fromScale(0.034, 0.113)
6764 colorPickerHeadline.Size = UDim2.fromOffset(173, 11)
6765 colorPickerHeadline.Font = Enum.Font.Code
6766 colorPickerHeadline.Text = colorPickerName or "???"
6767 colorPickerHeadline.TextColor3 = library.colors.elementText
6768 colored[1 + #colored] = {colorPickerHeadline, "TextColor3", "elementText"}
6769 colorPickerHeadline.TextSize = 14
6770 colorPickerHeadline.TextXAlignment = Enum.TextXAlignment.Left
6771 colorPickerButton.Name = "colorPickerButton"
6772 colorPickerButton.Parent = newColorPicker
6773 colorPickerButton.BackgroundColor3 = Color3.new(1, 1, 1)
6774 colorPickerButton.BackgroundTransparency = 1
6775 colorPickerButton.Size = UDim2.fromScale(1, 1)
6776 colorPickerButton.ZIndex = 5
6777 colorPickerButton.Font = Enum.Font.SourceSans
6778 colorPickerButton.Text = ""
6779 colorPickerButton.TextColor3 = Color3.new()
6780 colorPickerButton.TextSize = 14
6781 colorPickerButton.TextTransparency = 1
6782 colorPickerButton.BorderColor3 = library.colors.elementBorder
6783 local colored_colorPickerButton_BorderColor3 = {colorPickerButton, "BorderColor3", "elementBorder"}
6784 colored[1 + #colored] = colored_colorPickerButton_BorderColor3
6785 local function UpdateColorPicker(force, rainbsow)
6786 local last_vv = library_flags[flagName]
6787 local newColor = force or Color3.fromHSV(colorH, colorS, colorV)
6788 if not force then
6789 colorH, colorS, colorV = newColor:ToHSV()
6790 end
6791 colorPickerInner.BackgroundColor3 = darkenColor(newColor, 1.5)
6792 colorPickerInner.ImageColor3 = darkenColor(newColor, 2.5)
6793 color.BackgroundColor3 = Color3.fromHSV(colorH, 1, 1)
6794 library_flags[flagName] = newColor
6795 if options.Location then
6796 options.Location[options.LocationFlag or flagName] = newColor
6797 end
6798 hexInputBox.Text = Color3ToHex(newColor)
6799 if force then
6800 color.BackgroundColor3 = force
6801 selectorColor.Position = UDim2.new(force and select(3, Color3.toHSV(force)))
6802 end
6803 local pos = 1 - (Color3.toHSV(newColor))
6804 local scalex = selectorHue.Position.X.Scale
6805 if scalex ~= pos and not (((pos == 0) or (pos == 1)) and ((scalex == 1) or (scalex == 0))) then
6806 selectorHue.Position = UDim2.new(pos)
6807 end
6808 if callback and last_vv ~= newColor then
6809 task.spawn(callback, newColor, last_vv, rainbsow)
6810 end
6811 end
6812 library.signals[1 + #library.signals] = colorPickerButton.MouseButton1Click:Connect(function()
6813 if submenuOpen == colorPicker or submenuOpen == nil then
6814 colorPickerEnabled = not colorPickerEnabled
6815 library.colorpicker = colorPickerEnabled
6816 colorPickerHolderFrame.Visible = colorPickerEnabled
6817 if colorPickerEnabled then
6818 for _, v in next, colorpickerconflicts do
6819 v.Visible = false
6820 end
6821 submenuOpen = colorPicker
6822 newColorPicker.ZIndex = 2
6823 newSection.ZIndex = 100 + newSection.ZIndex
6824 colorPickerButton.BorderColor3 = library.colors.main
6825 colored_colorPickerButton_BorderColor3[3] = "main"
6826 UpdateColorPicker()
6827 else
6828 for _, v in next, colorpickerconflicts do
6829 v.Visible = true
6830 end
6831 submenuOpen = nil
6832 newColorPicker.ZIndex = 0
6833 newSection.ZIndex = newSection.ZIndex - 100
6834 colorPickerButton.BorderColor3 = library.colors.elementBorder
6835 colored_colorPickerButton_BorderColor3[3] = "elementBorder"
6836 end
6837 end
6838 end)
6839 colorPickerHolderFrame.Name = "colorPickerHolderFrame"
6840 colorPickerHolderFrame.Parent = newColorPicker
6841 colorPickerHolderFrame.Active = true
6842 colorPickerHolderFrame.BackgroundColor3 = library.colors.topGradient
6843 colored[1 + #colored] = {colorPickerHolderFrame, "BackgroundColor3", "topGradient"}
6844 colorPickerHolderFrame.BorderColor3 = library.colors.elementBorder
6845 colored[1 + #colored] = {colorPickerHolderFrame, "BorderColor3", "elementBorder"}
6846 colorPickerHolderFrame.Selectable = true
6847 colorPickerHolderFrame.Position = UDim2.fromScale(0.025, 1.012)
6848 colorPickerHolderFrame.Size = UDim2.fromOffset(206, 250)
6849 if math.ceil(colorPickerHolderFrame.AbsolutePosition.Y + colorPickerHolderFrame.AbsoluteSize.Y) > floor(newTabHolder.AbsoluteSize.Y + newTabHolder.AbsolutePosition.Y) then
6850 colorPickerHolderFrame.Position = UDim2.new(0.025, 0, 1.012, -colorPickerHolderFrame.AbsoluteSize.Y - colorPickerButton.AbsoluteSize.Y - 2)
6851 end
6852 colorPickerHolderFrame.Visible = false
6853 colorPickerHolderFrame.Image = "rbxassetid://2454009026"
6854 colorPickerHolderFrame.ImageColor3 = library.colors.bottomGradient
6855 colored[1 + #colored] = {colorPickerHolderFrame, "ImageColor3", "bottomGradient"}
6856 colorPickerHolderInner.Name = "colorPickerHolderInner"
6857 colorPickerHolderInner.Parent = colorPickerHolderFrame
6858 colorPickerHolderInner.Active = true
6859 colorPickerHolderInner.AnchorPoint = Vector2.new(0.5, 0.5)
6860 colorPickerHolderInner.BackgroundColor3 = library.colors.topGradient
6861 colored[1 + #colored] = {colorPickerHolderInner, "BackgroundColor3", "topGradient"}
6862 colorPickerHolderInner.BorderColor3 = library.colors.elementBorder
6863 colored[1 + #colored] = {colorPickerHolderInner, "BorderColor3", "elementBorder"}
6864 colorPickerHolderInner.Position = UDim2.fromScale(0.5, 0.5)
6865 colorPickerHolderInner.Selectable = true
6866 colorPickerHolderInner.Size = UDim2.new(1, -4, 1, -4)
6867 colorPickerHolderInner.Image = "rbxassetid://2454009026"
6868 colorPickerHolderInner.ImageColor3 = library.colors.bottomGradient
6869 colored[1 + #colored] = {colorPickerHolderInner, "ImageColor3", "bottomGradient"}
6870 color.Name = "color"
6871 color.Parent = colorPickerHolderInner
6872 color.BackgroundColor3 = startingColor
6873 color.BorderSizePixel = 0
6874 color.Position = UDim2.fromOffset(5, 5)
6875 color.Size = UDim2.new(1, -10, 0, 192)
6876 color.Image = "rbxassetid://4155801252"
6877 selectorColor.Name = "selectorColor"
6878 selectorColor.Parent = color
6879 selectorColor.AnchorPoint = Vector2.new(0.5, 0.5)
6880 selectorColor.BackgroundColor3 = Color3.fromRGB(144, 144, 144)
6881 selectorColor.BorderColor3 = Color3.fromRGB(69, 65, 70)
6882 selectorColor.Position = UDim2.new(startingColor and select(3, Color3.toHSV(startingColor)))
6883 selectorColor.Size = UDim2.fromOffset(4, 4)
6884 hue.Name = "hue"
6885 hue.Parent = colorPickerHolderInner
6886 hue.BackgroundColor3 = Color3.new(1, 1, 1)
6887 hue.BorderSizePixel = 0
6888 hue.Position = UDim2.fromOffset(5, 202)
6889 hue.Size = UDim2.new(1, -10, 0, 14)
6890 hue.Image = "rbxassetid://3570695787"
6891 hue.ScaleType = Enum.ScaleType.Slice
6892 hue.SliceScale = 0.01
6893 hueGradient.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 0, 4)), ColorSequenceKeypoint.new(0.17, Color3.fromRGB(235, 7, 255)), ColorSequenceKeypoint.new(0.33, Color3:fromRGB(9, 189)), ColorSequenceKeypoint.new(0.5, Color3:fromRGB(193, 196)), ColorSequenceKeypoint.new(0.66, Color3:new(1)), ColorSequenceKeypoint.new(0.84, Color3.fromRGB(255, 247)), ColorSequenceKeypoint.new(1, Color3.new(1))})
6894 hueGradient.Name = "hueGradient"
6895 hueGradient.Parent = hue
6896 selectorHue.Name = "selectorHue"
6897 selectorHue.Parent = hue
6898 selectorHue.BackgroundColor3 = Color3:fromRGB(125, 255)
6899 selectorHue.BackgroundTransparency = 0.2
6900 selectorHue.BorderColor3 = Color3:fromRGB(84, 91)
6901 selectorHue.Position = UDim2.new(1 - (Color3.toHSV(startingColor)))
6902 selectorHue.Size = UDim2:new(2, 1)
6903 hexInput.Name = "hexInput"
6904 hexInput.Parent = colorPickerHolderInner
6905 hexInput.Active = true
6906 hexInput.BackgroundColor3 = library.colors.topGradient
6907 colored[1 + #colored] = {hexInput, "BackgroundColor3", "topGradient"}
6908 hexInput.BorderColor3 = library.colors.elementBorder
6909 colored[1 + #colored] = {hexInput, "BorderColor3", "elementBorder"}
6910 hexInput.Position = UDim2.fromOffset(5, 223)
6911 hexInput.Selectable = true
6912 hexInput.Size = UDim2.fromOffset(150, 18)
6913 hexInput.Image = "rbxassetid://2454009026"
6914 hexInput.ImageColor3 = library.colors.bottomGradient
6915 colored[1 + #colored] = {hexInput, "ImageColor3", "bottomGradient"}
6916 hexInputInner.Name = "hexInputInner"
6917 hexInputInner.Parent = hexInput
6918 hexInputInner.Active = true
6919 hexInputInner.AnchorPoint = Vector2.new(0.5, 0.5)
6920 hexInputInner.BackgroundColor3 = library.colors.topGradient
6921 colored[1 + #colored] = {hexInputInner, "BackgroundColor3", "topGradient"}
6922 hexInputInner.BorderColor3 = library.colors.elementBorder
6923 colored[1 + #colored] = {hexInputInner, "BorderColor3", "elementBorder"}
6924 hexInputInner.Position = UDim2.fromScale(0.5, 0.5)
6925 hexInputInner.Selectable = true
6926 hexInputInner.Size = UDim2.new(1, -4, 1, -4)
6927 hexInputInner.Image = "rbxassetid://2454009026"
6928 hexInputInner.ImageColor3 = library.colors.bottomGradient
6929 colored[1 + #colored] = {hexInputInner, "ImageColor3", "bottomGradient"}
6930 hexInputBox.Name = "hexInputBox"
6931 hexInputBox.Parent = hexInput
6932 hexInputBox.BackgroundColor3 = Color3.new(1, 1, 1)
6933 hexInputBox.BackgroundTransparency = 1
6934 hexInputBox.Size = UDim2.fromScale(1, 1)
6935 hexInputBox.ZIndex = 5
6936 hexInputBox.Font = Enum.Font.Code
6937 hexInputBox.PlaceholderText = "Hex Input"
6938 hexInputBox.Text = Color3ToHex(startingColor)
6939 hexInputBox.TextColor3 = library.colors.elementText
6940 colored[1 + #colored] = {hexInputBox, "TextColor3", "elementText"}
6941 hexInputBox.TextSize = 14
6942 hexInputBox.ClearTextOnFocus = false
6943 randomColor.Name = "randomColor"
6944 randomColor.Parent = colorPickerHolderInner
6945 randomColor.Active = true
6946 randomColor.BackgroundColor3 = library.colors.topGradient
6947 colored[1 + #colored] = {randomColor, "BackgroundColor3", "topGradient"}
6948 randomColor.BorderColor3 = library.colors.elementBorder
6949 colored[1 + #colored] = {randomColor, "BorderColor3", "elementBorder"}
6950 randomColor.Position = UDim2.fromOffset(158, 223)
6951 randomColor.Selectable = true
6952 randomColor.Size = UDim2.fromOffset(18, 18)
6953 randomColor.Image = "rbxassetid://2454009026"
6954 randomColor.ImageColor3 = library.colors.bottomGradient
6955 colored[1 + #colored] = {randomColor, "ImageColor3", "bottomGradient"}
6956 randomColorInner.Name = "randomColorInner"
6957 randomColorInner.Parent = randomColor
6958 randomColorInner.Active = true
6959 randomColorInner.AnchorPoint = Vector2.new(0.5, 0.5)
6960 randomColorInner.BackgroundColor3 = library.colors.topGradient
6961 colored[1 + #colored] = {randomColorInner, "BackgroundColor3", "topGradient"}
6962 randomColorInner.BorderColor3 = library.colors.elementBorder
6963 colored[1 + #colored] = {randomColorInner, "BorderColor3", "elementBorder"}
6964 randomColorInner.Position = UDim2.fromScale(0.5, 0.5)
6965 randomColorInner.Selectable = true
6966 randomColorInner.Size = UDim2.new(1, -4, 1, -4)
6967 randomColorInner.Image = "rbxassetid://2454009026"
6968 randomColorInner.ImageColor3 = library.colors.bottomGradient
6969 colored[1 + #colored] = {randomColorInner, "ImageColor3", "bottomGradient"}
6970 randomColorButton.Name = "randomColorButton"
6971 randomColorButton.Parent = randomColor
6972 randomColorButton.BackgroundColor3 = Color3.new(1, 1, 1)
6973 randomColorButton.BackgroundTransparency = 1
6974 randomColorButton.Size = UDim2.fromScale(1, 1)
6975 randomColorButton.ZIndex = 5
6976 randomColorButton.Image = "rbxassetid://7484765651"
6977 rainbow.Name = "rainbow"
6978 rainbow.Parent = colorPickerHolderInner
6979 rainbow.Active = true
6980 rainbow.BackgroundColor3 = library.colors.topGradient
6981 colored[1 + #colored] = {rainbow, "BackgroundColor3", "topGradient"}
6982 rainbow.BorderColor3 = library.colors.elementBorder
6983 colored[1 + #colored] = {rainbow, "BorderColor3", "elementBorder"}
6984 rainbow.Position = UDim2.fromOffset(158 + 18 + 4, 223)
6985 rainbow.Selectable = true
6986 rainbow.Size = UDim2.fromOffset(18, 18)
6987 rainbow.Image = "rbxassetid://2454009026"
6988 rainbow.ImageColor3 = library.colors.bottomGradient
6989 colored[1 + #colored] = {rainbow, "ImageColor3", "bottomGradient"}
6990 rainbowInner.Name = "rainbowInner"
6991 rainbowInner.Parent = randomColor
6992 rainbowInner.Active = true
6993 rainbowInner.AnchorPoint = Vector2.new(0.5, 0.5)
6994 rainbowInner.BackgroundColor3 = library.colors.topGradient
6995 colored[1 + #colored] = {rainbowInner, "BackgroundColor3", "topGradient"}
6996 rainbowInner.BorderColor3 = library.colors.elementBorder
6997 colored[1 + #colored] = {rainbowInner, "BorderColor3", "elementBorder"}
6998 rainbowInner.Position = UDim2.fromScale(0.5, 0.5)
6999 rainbowInner.Selectable = true
7000 rainbowInner.Size = UDim2.new(1, -4, 1, -4)
7001 rainbowInner.Image = "rbxassetid://2454009026"
7002 rainbowInner.ImageColor3 = library.colors.bottomGradient
7003 colored[1 + #colored] = {rainbowInner, "ImageColor3", "bottomGradient"}
7004 rainbowButton.Name = "rainbowButton"
7005 rainbowButton.Parent = rainbow
7006 rainbowButton.BackgroundColor3 = Color3.new(1, 1, 1)
7007 rainbowButton.BackgroundTransparency = 1
7008 rainbowButton.Size = UDim2.fromScale(1, 1)
7009 rainbowButton.ZIndex = 5
7010 rainbowButton.Image = "rbxassetid://7484772919"
7011 local indexwith = (designers and "rainbows") or "rainbowsg"
7012 local function setrainbow(t, rainbowColorMod)
7013 if nil == rainbowColorMod and t ~= nil then
7014 rainbowColorMod = t
7015 end
7016 if rainbowColorMod == nil or type(rainbowColorMod) ~= "boolean" then
7017 rainbowColorMode = not rainbowColorMode
7018 else
7019 rainbowColorMode = rainbowColorMod
7020 end
7021 if colorInput then
7022 colorInput = (colorInput:Disconnect() and nil) or nil
7023 end
7024 if hueInput then
7025 hueInput = (hueInput:Disconnect() and nil) or nil
7026 end
7027 pcall(function()
7028 if destroyrainbows and library.rainbows <= 0 then
7029 destroyrainbows = nil
7030 end
7031 if destroyrainbowsg and library.rainbowsg <= 0 then
7032 destroyrainbowsg = nil
7033 end
7034 end)
7035 if rainbowColorMode then
7036 pcall(function()
7037 if not library.rainbowflags[flagName] then
7038 library[indexwith] = 1 + library[indexwith]
7039 end
7040 library.rainbowflags[flagName] = true
7041 oldImageColor = colorPickerInner.ImageColor3
7042 oldBackgroundColor = colorPickerInner.BackgroundColor3
7043 oldColor = color.BackgroundColor3
7044 pcall(function()
7045 local common_float = 1 / 255
7046 while wait_check() and rainbowColorMode and (options.Value == "rainbow" or ((not designers and not destroyrainbowsg) or (designers and not destroyrainbows))) do
7047 rainbowColorValue = common_float + rainbowColorValue
7048 if rainbowColorValue > 1 then
7049 rainbowColorValue = 0
7050 end
7051 colorH = rainbowColorValue
7052 UpdateColorPicker(Color3.fromHSV(rainbowColorValue, 1, 1), true)
7053 end
7054 end)
7055 end)
7056 pcall(function()
7057 rainbowColorMode = nil
7058 if library.rainbowflags[flagName] then
7059 library[indexwith] = library[indexwith] - 1
7060 end
7061 library.rainbowflags[flagName] = nil
7062 end)
7063 end
7064 UpdateColorPicker(library_flags[flagName])
7065 end
7066 library.signals[1 + #library.signals] = randomColorButton.MouseButton1Click:Connect(function()
7067 if rainbowColorMode then
7068 setrainbow(false)
7069 end
7070 UpdateColorPicker(Color3.fromRGB(math.random(0, 255), math.random(0, 255), math.random(0, 255)))
7071 end)
7072 library.signals[1 + #library.signals] = rainbowButton.MouseButton1Click:Connect(setrainbow)
7073 sectionFunctions:Update()
7074 library.signals[1 + #library.signals] = newColorPicker.MouseEnter:Connect(function()
7075 tweenService:Create(colorPicker, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
7076 BackgroundColor3 = darkenColor(library.colors.main, 1.5),
7077 ImageColor3 = darkenColor(library.colors.main, 2.5)
7078 }):Play()
7079 colored_colorPicker_BackgroundColor3[3] = "main"
7080 colored_colorPicker_BackgroundColor3[4] = 1.5
7081 colored_colorPicker_ImageColor3[3] = "main"
7082 colored_colorPicker_ImageColor3[4] = 2.5
7083 end)
7084 library.signals[1 + #library.signals] = newColorPicker.MouseLeave:Connect(function()
7085 if not colorPickerEnabled then
7086 tweenService:Create(colorPicker, TweenInfo.new(0.25, library.configuration.easingStyle, library.configuration.easingDirection), {
7087 BackgroundColor3 = library.colors.topGradient,
7088 ImageColor3 = library.colors.bottomGradient
7089 }):Play()
7090 colored_colorPicker_BackgroundColor3[3] = "topGradient"
7091 colored_colorPicker_BackgroundColor3[4] = nil
7092 colored_colorPicker_ImageColor3[3] = "bottomGradient"
7093 colored_colorPicker_ImageColor3[4] = nil
7094 end
7095 end)
7096 hexInputBox.FocusLost:Connect(function()
7097 if #hexInputBox.Text > 5 then
7098 local last_vv = library_flags[flagName]
7099 local not_fucked, clr = pcall(Color3FromHex, hexInputBox.Text)
7100 UpdateColorPicker((not_fucked and clr) or last_vv)
7101 end
7102 end)
7103 colorH = 1 - (math.clamp(selectorHue.AbsolutePosition.X - hue.AbsolutePosition.X, 0, hue.AbsoluteSize.X) / hue.AbsoluteSize.X)
7104 colorS = (math.clamp(selectorColor.AbsolutePosition.X - color.AbsolutePosition.X, 0, color.AbsoluteSize.X) / color.AbsoluteSize.X)
7105 colorV = 1 - (math.clamp(selectorColor.AbsolutePosition.Y - color.AbsolutePosition.Y, 0, color.AbsoluteSize.Y) / color.AbsoluteSize.Y)
7106 library.signals[1 + #library.signals] = color.InputBegan:Connect(function(input)
7107 if input.UserInputType == Enum.UserInputType.MouseButton1 then
7108 isDraggingSomething = true
7109 colorInput = (colorInput and colorInput:Disconnect() and nil) or runService.RenderStepped:Connect(function()
7110 local colorX = (math.clamp(mouse.X - color.AbsolutePosition.X, 0, color.AbsoluteSize.X) / color.AbsoluteSize.X)
7111 local colorY = (math.clamp(mouse.Y - color.AbsolutePosition.Y, 0, color.AbsoluteSize.Y) / color.AbsoluteSize.Y)
7112 selectorColor.Position = UDim2.fromScale(colorX, colorY)
7113 colorS = colorX
7114 colorV = 1 - colorY
7115 UpdateColorPicker()
7116 end)
7117 library.signals[1 + #library.signals] = colorInput
7118 end
7119 end)
7120 library.signals[1 + #library.signals] = color.InputEnded:Connect(function(input)
7121 if input.UserInputType == Enum.UserInputType.MouseButton1 then
7122 if colorInput then
7123 isDraggingSomething = false
7124 colorInput:Disconnect()
7125 end
7126 end
7127 end)
7128 library.signals[1 + #library.signals] = hue.InputBegan:Connect(function(input)
7129 if input.UserInputType == Enum.UserInputType.MouseButton1 then
7130 if hueInput then
7131 hueInput:Disconnect()
7132 end
7133 isDraggingSomething = true
7134 hueInput = runService.RenderStepped:Connect(function()
7135 local hueX = math.clamp(mouse.X - hue.AbsolutePosition.X, 0, hue.AbsoluteSize.X) / hue.AbsoluteSize.X
7136 selectorHue.Position = UDim2.new(hueX)
7137 colorH = 1 - hueX
7138 UpdateColorPicker()
7139 end)
7140 library.signals[1 + #library.signals] = hueInput
7141 end
7142 end)
7143 library.signals[1 + #library.signals] = hue.InputEnded:Connect(function(input)
7144 if hueInput and input.UserInputType == Enum.UserInputType.MouseButton1 then
7145 isDraggingSomething = false
7146 hueInput:Disconnect()
7147 end
7148 end)
7149 if rainbowColorMode then
7150 spawn(function()
7151 rainbowColorMode = nil
7152 setrainbow(true)
7153 end)
7154 end
7155 local function Set(t, clr)
7156 if clr == nil and t ~= nil then
7157 clr = t
7158 end
7159 if clr == "rainbow" then
7160 if not rainbowColorMode then
7161 task.spawn(setrainbow, true)
7162 end
7163 return
7164 elseif clr == "random" then
7165 clr = Color3.new(math.random(), math.random(), math.random())
7166 elseif type(clr) == "string" and tonumber(clr, 16) then
7167 clr = Color3FromHex(clr)
7168 end
7169 task.spawn(setrainbow, false)
7170 local last_v = library_flags[flagName]
7171 library_flags[flagName] = clr
7172 if options.Location then
7173 options.Location[options.LocationFlag or flagName] = clr
7174 end
7175 color.BackgroundColor3 = clr
7176 selectorColor.Position = UDim2.new(clr and select(3, Color3.toHSV(clr)))
7177 selectorHue.Position = UDim2.new(1 - (Color3.toHSV(clr)))
7178 colorPickerInner.BackgroundColor3 = darkenColor(clr, 1.5)
7179 colorPickerInner.ImageColor3 = darkenColor(clr, 2.5)
7180 hexInputBox.Text = Color3ToHex(clr)
7181 colorH, colorS, colorV = Color3.toHSV(clr)
7182 if callback and (last_v ~= clr or options.AllowDuplicateCalls) then
7183 task.spawn(callback, clr, last_v)
7184 end
7185 return clr
7186 end
7187 if presetColor ~= nil then
7188 Set(presetColor)
7189 else
7190 library_flags[flagName] = startingColor
7191 if options.Location then
7192 options.Location[options.LocationFlag or flagName] = startingColor
7193 end
7194 end
7195 local default = options.Value or startingColor or library_flags[flagName]
7196 local function update()
7197 colorPickerName, callback = options.Name or colorPickerName, options.Callback
7198 local clr = library_flags[flagName]
7199 color.BackgroundColor3 = clr
7200 selectorColor.Position = UDim2.new(clr and select(3, Color3.toHSV(clr)))
7201 selectorHue.Position = UDim2.new(1 - (Color3.toHSV(clr)))
7202 colorPickerInner.BackgroundColor3 = darkenColor(clr, 1.5)
7203 colorPickerInner.ImageColor3 = darkenColor(clr, 2.5)
7204 hexInputBox.Text = Color3ToHex(clr)
7205 colorPickerHeadline.Text = colorPickerName or "???"
7206 return clr
7207 end
7208 local objectdata = {
7209 Options = options,
7210 Name = flagName,
7211 Flag = flagName,
7212 Type = "Colorpicker",
7213 Default = default,
7214 Parent = sectionFunctions,
7215 Instance = newColorPicker,
7216 SetRainbow = setrainbow,
7217 Get = function()
7218 return library_flags[flagName]
7219 end,
7220 GetRainbow = function()
7221 return rainbowColorMode
7222 end,
7223 Set = Set,
7224 Remove = function()
7225 if newColorPicker then
7226 newColorPicker.Parent = nil
7227 sectionFunctions:Update()
7228 end
7229 end,
7230 RawSet = function(t, clr)
7231 if clr == nil and t ~= nil then
7232 clr = t
7233 end
7234 if clr == "rainbow" then
7235 if not rainbowColorMode then
7236 task.spawn(setrainbow, true)
7237 end
7238 return clr
7239 elseif clr == "random" then
7240 clr = Color3.new(math.random(), math.random(), math.random())
7241 elseif clr and type(clr) == "string" and tonumber(clr, 16) then
7242 clr = Color3FromHex(clr)
7243 end
7244 task.spawn(setrainbow, false)
7245 library_flags[flagName] = clr
7246 if options.Location then
7247 options.Location[options.LocationFlag or flagName] = clr
7248 end
7249 return clr
7250 end,
7251 Update = update,
7252 Reset = function()
7253 return Set(nil, default)
7254 end
7255 }
7256 tabFunctions.Flags[flagName], sectionFunctions.Flags[flagName], elements[flagName] = objectdata, objectdata, objectdata
7257 return objectdata
7258 end
7259 sectionFunctions.AddColorPicker = sectionFunctions.AddColorpicker
7260 sectionFunctions.NewColorpicker = sectionFunctions.AddColorpicker
7261 sectionFunctions.NewColorPicker = sectionFunctions.AddColorpicker
7262 sectionFunctions.CreateColorPicker = sectionFunctions.AddColorpicker
7263 sectionFunctions.CreateColorpicker = sectionFunctions.AddColorpicker
7264 sectionFunctions.ColorPicker = sectionFunctions.AddColorpicker
7265 sectionFunctions.Colorpicker = sectionFunctions.AddColorpicker
7266 sectionFunctions.Cp = sectionFunctions.AddColorpicker
7267 sectionFunctions.CP = sectionFunctions.AddColorpicker
7268 return sectionFunctions
7269 end
7270 tabFunctions.AddSection = tabFunctions.CreateSection
7271 tabFunctions.NewSection = tabFunctions.CreateSection
7272 tabFunctions.Section = tabFunctions.CreateSection
7273 tabFunctions.Sec = tabFunctions.CreateSection
7274 tabFunctions.S = tabFunctions.CreateSection
7275 function tabFunctions:UpdateAll()
7276 local target = self or tabFunctions
7277 if target and type(target) == "table" and target.Flags then
7278 for _, e in next, target.Flags do
7279 if e and type(e) == "table" and e.Update then
7280 pcall(e.Update)
7281 end
7282 end
7283 end
7284 end
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295 return tabFunctions
7296 end
7297 windowFunctions.AddTab = windowFunctions.CreateTab
7298 windowFunctions.NewTab = windowFunctions.CreateTab
7299 windowFunctions.Tab = windowFunctions.CreateTab
7300 windowFunctions.T = windowFunctions.CreateTab
7301 function windowFunctions:CreateDesigner(options, ...)
7302 options = (options and type(options) == "string" and resolvevararg("Tab", options, ...)) or options
7303 assert(shared.bypasstablimit or (library.Designer == nil), "Designer already exists")
7304 options = options or {}
7305 options.Image = options.Image or 7483871523
7306 options.LastTab = true
7307 local designer = windowFunctions:CreateTab(options)
7308 local colorsection = designer:CreateSection({
7309 Name = "Colors"
7310 })
7311 local backgroundsection = designer:CreateSection({
7312 Name = "Background",
7313 Side = "right"
7314 })
7315 local detailssection = designer:CreateSection({
7316 Name = "More Info"
7317 })
7318 local filessection = designer:CreateSection({
7319 Name = "Profiles",
7320 Side = "right"
7321 })
7322 local settingssection = designer:CreateSection({
7323 Name = "Settings",
7324 Side = "right"
7325 })
7326 local designerelements = {}
7327 library.designerelements = designerelements
7328 for _, v in next, {{"Main", "main"}, {"Background", "background"}, {"Outer Border", "outerBorder"}, {"Inner Border", "innerBorder"}, {"Top Gradient", "topGradient"}, {"Bottom Gradient", "bottomGradient"}, {"Section Background", "sectionBackground"}, {"Section", "section"}, {"Element Text", "elementText"}, {"Other Element Text", "otherElementText"}, {"Tab Text", "tabText"}, {"Element Border", "elementBorder"}, {"Selected Option", "selectedOption"}, {"Unselected Option", "unselectedOption"}, {"Hovered Option Top", "hoveredOptionTop"}, {"Unhovered Option Top", "unhoveredOptionTop"}, {"Hovered Option Bottom", "hoveredOptionBottom"}, {"Unhovered Option Bottom", "unhoveredOptionBottom"}} do
7329 local nam, codename = v[1], v[2]
7330 local cflag = "__Designer.Colors." .. codename
7331 designerelements[codename] = {
7332 Return = colorsection:AddColorpicker({
7333 Name = nam,
7334 Flag = cflag,
7335 Value = library.colors[codename],
7336 Callback = function(v, y)
7337 library.colors[codename] = v or y
7338 end,
7339 __designer = 1
7340 }),
7341 Flag = cflag
7342 }
7343 end
7344 local flags = {}
7345 local persistoptions = {
7346 Name = "Workspace Profile",
7347 Flag = "__Designer.Background.WorkspaceProfile",
7348 Flags = true,
7349 Suffix = "Config",
7350 Workspace = library.WorkspaceName or "Unnamed Workspace",
7351 Desginer = true
7352 }
7353 local daaata = {{"AddTextbox", "__Designer.Textbox.ImageAssetID", backgroundsection, {
7354 Name = "Image Asset ID",
7355 Placeholder = "rbxassetid://4427304036",
7356 Flag = "__Designer.Background.ImageAssetID",
7357 Value = "rbxassetid://4427304036",
7358 Callback = updatecolorsnotween
7359 }}, {"AddColorpicker", "__Designer.Colorpicker.ImageColor", backgroundsection, {
7360 Name = "Image Color",
7361 Flag = "__Designer.Background.ImageColor",
7362 Value = Color3.new(1, 1, 1),
7363 Callback = updatecolorsnotween,
7364 __designer = 1
7365 }}, {"AddSlider", "__Designer.Slider.ImageTransparency", backgroundsection, {
7366 Name = "Image Transparency",
7367 Flag = "__Designer.Background.ImageTransparency",
7368 Value = 95,
7369 Min = 0,
7370 Max = 100,
7371 Format = "Image Transparency: %s%%",
7372 Textbox = true,
7373 Callback = updatecolorsnotween
7374 }}, {"AddToggle", "__Designer.Toggle.UseBackgroundImage", backgroundsection, {
7375 Name = "Use Background Image",
7376 Flag = "__Designer.Background.UseBackgroundImage",
7377 Value = true,
7378 Callback = updatecolorsnotween
7379 }}, {"AddPersistence", "__Designer.Persistence.ThemeFile", filessection, {
7380 Name = "Theme Profile",
7381 Flag = "__Designer.Files.ThemeFile",
7382 Workspace = "Pepsi Lib Themes",
7383 Flags = flags,
7384 Suffix = "Theme",
7385 Desginer = true
7386 }}, {"AddTextbox", "__Designer.Textbox.WorkspaceName", filessection, {
7387 Name = "Workspace Name",
7388 Value = library.WorkspaceName or "Unnamed Workspace",
7389 Flag = "__Designer.Files.WorkspaceFile",
7390 Callback = function(n, o)
7391 persistoptions.Workspace = n or o
7392 end
7393 }}, {"AddPersistence", "__Designer.Persistence.WorkspaceProfile", filessection, persistoptions}, {"AddButton", "__Designer.Button.TerminateGUI", settingssection, {{
7394 Name = "Terminate GUI",
7395 Callback = library.unload
7396 }, {
7397 Name = "Reset GUI",
7398 Callback = resetall
7399 }, {
7400 Name = "Reset Designer",
7401 Callback = function()
7402 destroyrainbows = true
7403 pcall(function()
7404 for k, v in next, elements do
7405 if v and k and v.Set and (v.Default ~= nil) and (library_flags[k] ~= v.Default) and (string.sub(k, 1, 11) == "__Designer.") then
7406 v:Set(v.Default)
7407 end
7408 end
7409 end)
7410 end
7411 }}}, {"AddKeybind", "__Designer.Keybind.ShowHideKey", settingssection, {
7412 Name = "Show/Hide Key",
7413 Location = library.configuration,
7414 Flag = "__Designer.Settings.ShowHideKey",
7415 LocationFlag = "hideKeybind",
7416 Value = library.configuration.hideKeybind,
7417 CoreBinding = true,
7418 Callback = function()
7419 lasthidebing = os.clock()
7420 end
7421 }}, {"AddLabel", "__Designer.Label.Version", settingssection, {
7422 Name = "Library Version: " .. tostring(library.Version or "?")
7423 }}}
7424 if setclipboard and daaata[8] then
7425 local common_table = daaata[8][4]
7426 if common_table then
7427 common_table[1 + #common_table] = {
7428 Name = "Copy Theme",
7429 Callback = function()
7430 local working_with = {}
7431 if #flags > 0 then
7432 for k, cflag in next, flags do
7433 if k > 0 then
7434 local data = elements[cflag]
7435 if data and (data.Type ~= "Persistence") and (string.sub(cflag, 1, 11) == "__Designer.") then
7436 working_with[cflag] = data
7437 end
7438 end
7439 end
7440 end
7441 local saving = {}
7442 for cflag in next, working_with do
7443 local value = library_flags[cflag]
7444 local good, jval = nil, nil
7445 if value ~= nil then
7446 good, jval = JSONEncode(value)
7447 else
7448 good, jval = true, "null"
7449 end
7450 if not good or ((jval == "null") and (value ~= nil)) then
7451 local typ = typeof(value)
7452 if typ == "Color3" then
7453 value = (library.rainbowflags[cflag] and "rainbow") or Color3ToHex(value)
7454 end
7455 value = tostring(value)
7456 good, jval = JSONEncode(value)
7457 if not good or ((jval == "null") and (value ~= nil)) then
7458 warn("Could not save value:", value, debug.traceback(""))
7459 end
7460 end
7461 if good and jval then
7462 saving[cflag] = value
7463 end
7464 end
7465 local good, content = JSONEncode(saving)
7466 if good and content then
7467 setclipboard(content)
7468 end
7469 end
7470 }
7471 common_table = nil
7472 end
7473 end
7474 if options.Credit ~= false then
7475 daaata[1 + #daaata] = {"AddLabel", "__Designer.Label.Creator", detailssection, {
7476 Text = "Library by Pepsi#5229 "
7477 }}
7478 elseif "Gee, thanks for your support." then
7479 end
7480 if options.Info then
7481 local typ = type(options.Info)
7482 if typ == "string" then
7483 daaata[1 + #daaata] = {"AddLabel", "__Designer.Label.Creator", detailssection, {
7484 Text = options.Info
7485 }}
7486 elseif typ == "table" and #options.Info > 0 then
7487 for _, v in next, options.Info do
7488 daaata[1 + #daaata] = {"AddLabel", "__Designer.Label.Creator", detailssection, {
7489 Text = tostring(v)
7490 }}
7491 end
7492 end
7493 end
7494 for _, v in next, daaata do
7495 designerelements[v[2]] = v[3][v[1]](v[3], v[4])
7496 end
7497 designerelements["__Designer.Textbox.WorkspaceName"]:Set(library.WorkspaceName or "Unnamed Workspace")
7498 for k, v in next, elements do
7499 if v and k and string.sub(k, 1, 11) == "__Designer." and v.Type and v.Type ~= "Persistence" then
7500 flags[1 + #flags] = k
7501 end
7502 end
7503 if library.Backdrop then
7504 library.Backdrop.Image = resolveid(library_flags["__Designer.Background.ImageAssetID"], "__Designer.Background.ImageAssetID") or ""
7505 library.Backdrop.Visible = library_flags["__Designer.Background.UseBackgroundImage"] and true
7506 library.Backdrop.ImageTransparency = (library_flags["__Designer.Background.ImageTransparency"] or 95) / 100
7507 library.Backdrop.ImageColor3 = library_flags["__Designer.Background.ImageColor"] or Color3.new(1, 1, 1)
7508 end
7509 local function setbackground(t, Asset, Transparency, Visible)
7510 if Visible == nil and t ~= nil and type(t) ~= "table" then
7511 Asset, Transparency, Visible = t, Transparency, Visible
7512 end
7513 if Visible == 0 or ((Asset == 0 or Asset == false) and Visible == nil and Transparency == nil) then
7514 Visible = false
7515 elseif Visible == 1 or ((Asset == 1 or Asset == true) and Visible == nil and Transparency == nil) then
7516 Visible = true
7517 elseif Asset == nil and Transparency == nil and Visible == nil then
7518 Visible = not library_flags["__Designer.Background.UseBackgroundImage"]
7519 end
7520 local temp = Asset and type(Asset)
7521 if Transparency == nil and Visible == nil and temp == "number" and ((Asset ~= 1 and Asset ~= 0) or (Asset > 0 and Asset <= 100)) then
7522 Transparency, Asset, temp = Asset, nil
7523 end
7524 if temp and ((temp == "number" and Asset > 1) or temp == "string") then
7525 designerelements["__Designer.Textbox.ImageAssetID"]:Set(Asset)
7526 end
7527 temp = tonumber(Transparency)
7528 temp = (temp >= 0 and temp <= 1 and temp * 100) or temp
7529 if temp then
7530 designerelements["__Designer.Slider.ImageTransparency"]:Set(temp)
7531 end
7532 if Visible ~= nil then
7533 designerelements["__Designer.Toggle.UseBackgroundImage"]:Set(Visible and true)
7534 end
7535 return Asset, Transparency, Visible
7536 end
7537 local bk = options.Background or options.Backdrop or options.Grahpic
7538 if bk then
7539 if type(bk) == "table" then
7540 setbackground(bk.Asset or bk[1], bk.Transparency or bk[2], bk.Visible or bk[3])
7541 else
7542 setbackground(bk, 0, 1)
7543 end
7544 end
7545 library.Designer = {
7546 Options = options,
7547 Parent = windowFunctions,
7548 Name = "Designer",
7549 Flag = "Designer",
7550 Type = "Designer",
7551 Instance = designer,
7552 SetBackground = setbackground,
7553 Remove = designer.Remove
7554 }
7555 library.SetBackground = setbackground
7556 local savestuff = library.elements["__Designer.Background.WorkspaceProfile"]
7557 if savestuff then
7558 library.LoadFile = savestuff.LoadFile
7559 library.LoadFileRaw = savestuff.LoadFileRaw
7560 library.LoadJSON = savestuff.LoadJSON
7561 library.LoadJSONRaw = savestuff.LoadJSONRaw
7562 library.SaveFile = savestuff.SaveFile
7563 library.GetJSON = savestuff.GetJSON
7564 end
7565 spawn(updatecolorsnotween)
7566 local dorlod = nil
7567 if options.HideTheme then
7568 designer.Remove()
7569 dorlod = true
7570 elseif options.LockTheme then
7571 if colorsection then
7572 colorsection.Remove()
7573 dorlod = true
7574 end
7575 if backgroundsection then
7576 backgroundsection.Remove()
7577 dorlod = true
7578 end
7579 if designerelements then
7580 local thing = designerelements["__Designer.Persistence.ThemeFile"]
7581 if thing then
7582 thing.Remove()
7583 dorlod = true
7584 end
7585 thing = designerelements["__Designer.Button.TerminateGUI"]
7586 thing = thing and thing[3]
7587 if thing then
7588 thing.Remove()
7589 dorlod = true
7590 end
7591 end
7592 end
7593 if dorlod then
7594 windowFunctions:UpdateAll()
7595 end
7596 return library.Designer
7597 end
7598 windowFunctions.AddDesigner = windowFunctions.CreateDesigner
7599 windowFunctions.NewDesigner = windowFunctions.CreateDesigner
7600 windowFunctions.Designer = windowFunctions.CreateDesigner
7601 windowFunctions.D = windowFunctions.CreateDesigner
7602 function windowFunctions:UpdateAll()
7603 local target = self or windowFunctions
7604 if target and type(target) == "table" and target.Flags then
7605 for _, e in next, target.Flags do
7606 if e and type(e) == "table" then
7607 if e.Update then
7608 pcall(e.Update)
7609 end
7610 if e.UpdateAll then
7611 pcall(e.Update)
7612 end
7613 end
7614 end
7615 pcall(function()
7616 if library.Backdrop then
7617 library.Backdrop.Visible = library_flags["__Designer.Background.UseBackgroundImage"] and true
7618 library.Backdrop.Image = resolveid(library_flags["__Designer.Background.ImageAssetID"], "__Designer.Background.ImageAssetID") or ""
7619 library.Backdrop.ImageColor3 = library_flags["__Designer.Background.ImageColor"] or Color3.new(1, 1, 1)
7620 library.Backdrop.ImageTransparency = (library_flags["__Designer.Background.ImageTransparency"] or 95) / 100
7621 end
7622 end)
7623 end
7624 end
7625 library.UpdateAll = windowFunctions.UpdateAll
7626 if options.Themeable or options.DefaultTheme or options.Theme then
7627 spawn(function()
7628 local os_clock = os.clock
7629 local starttime = os_clock()
7630 while os_clock() - starttime < 12 do
7631 if homepage then
7632 windowFunctions.GoHome = homepage
7633 local x, e = pcall(homepage)
7634 if not x and e then
7635 warn("Error going to Homepage:", e)
7636 end
7637 x, e = nil
7638 break
7639 end
7640 task.wait()
7641 end
7642 local whatDoILookLike = options.Themeable or options.DefaultTheme or options.Theme
7643 if type(whatDoILookLike) == "table" then
7644 whatDoILookLike.LockTheme = whatDoILookLike.LockTheme or options.LockTheme or nil
7645 whatDoILookLike.HideTheme = whatDoILookLike.HideTheme or options.HideTheme or nil
7646 else
7647 whatDoILookLike = nil
7648 end
7649 windowFunctions:CreateDesigner(whatDoILookLike)
7650 if options.DefaultTheme or options.Theme then
7651 spawn(function()
7652 local content = options.DefaultTheme or options.Theme or options.JSON or options.ThemeJSON
7653 if content and type(content) == "string" and #content > 1 then
7654 local good, jcontent = JSONDecode(content)
7655 if good and jcontent then
7656 for cflag, val in next, jcontent do
7657 local data = elements[cflag]
7658 if data and (data.Type ~= "Persistence") then
7659 if data.Set then
7660 data:Set(val)
7661 elseif data.RawSet then
7662 data:RawSet(val)
7663 else
7664 library.flags[cflag] = val
7665 end
7666 end
7667 end
7668 end
7669 end
7670 end)
7671 end
7672 os_clock, starttime = nil
7673 end)
7674 end
7675 return windowFunctions
7676end
7677library.NewWindow = library.CreateWindow
7678library.AddWindow = library.CreateWindow
7679library.Window = library.CreateWindow
7680library.W = library.CreateWindow
7681return library, library_flags, library.subs