-
Notifications
You must be signed in to change notification settings - Fork 319
/
Dynago UI lib.
706 lines (583 loc) · 23.9 KB
/
Dynago UI lib.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
--Made by : iiVxlocity
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local CoreGuiService = game:GetService("CoreGui")
local RunService = game:GetService("RunService")
local TextService = game:GetService("TextService")
local TweenTime = 0.1
local Level = 1
local GlobalTweenInfo = TweenInfo.new(TweenTime)
local AlteredTweenInfo = TweenInfo.new(TweenTime, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local DropShadowID = "rbxassetid://297774371"
local DropShadowTransparency = 0.3
local IconLibraryID = "rbxassetid://3926305904"
local IconLibraryID2 = "rbxassetid://3926307971"
local MainFont = Enum.Font.Gotham
local function GetXY(GuiObject)
local X, Y = Mouse.X - GuiObject.AbsolutePosition.X, Mouse.Y - GuiObject.AbsolutePosition.Y
local MaxX, MaxY = GuiObject.AbsoluteSize.X, GuiObject.AbsoluteSize.Y
X, Y = math.clamp(X, 0, MaxX), math.clamp(Y, 0, MaxY)
return X, Y, X/MaxX, Y/MaxY
end
local function TitleIcon(ButtonOrNot)
local NewTitleIcon = Instance.new(ButtonOrNot and "ImageButton" or "ImageLabel")
NewTitleIcon.Name = "TitleIcon"
NewTitleIcon.BackgroundTransparency = 1
NewTitleIcon.Image = IconLibraryID
NewTitleIcon.ImageRectOffset = Vector2.new(524, 764)
NewTitleIcon.ImageRectSize = Vector2.new(36, 36)
NewTitleIcon.Size = UDim2.new(0,14,0,14)
NewTitleIcon.Position = UDim2.new(1,-17,0,3)
NewTitleIcon.Rotation = 180
NewTitleIcon.ZIndex = Level
return NewTitleIcon
end
local function TickIcon(ButtonOrNot)
local NewTickIcon = Instance.new(ButtonOrNot and "ImageButton" or "ImageLabel")
NewTickIcon.Name = "TickIcon"
NewTickIcon.BackgroundTransparency = 1
NewTickIcon.Image = "rbxassetid://3926305904"
NewTickIcon.ImageRectOffset = Vector2.new(312,4)
NewTickIcon.ImageRectSize = Vector2.new(24,24)
NewTickIcon.Size = UDim2.new(1,-6,1,-6)
NewTickIcon.Position = UDim2.new(0,3,0,3)
NewTickIcon.ZIndex = Level
return NewTickIcon
end
local function DropdownIcon(ButtonOrNot)
local NewDropdownIcon = Instance.new(ButtonOrNot and "ImageButton" or "ImageLabel")
NewDropdownIcon.Name = "DropdownIcon"
NewDropdownIcon.BackgroundTransparency = 1
NewDropdownIcon.Image = IconLibraryID2
NewDropdownIcon.ImageRectOffset = Vector2.new(324,364)
NewDropdownIcon.ImageRectSize = Vector2.new(36,36)
NewDropdownIcon.Size = UDim2.new(0,16,0,16)
NewDropdownIcon.Position = UDim2.new(1,-18,0,2)
NewDropdownIcon.ZIndex = Level
return NewDropdownIcon
end
local function SearchIcon(ButtonOrNot)
local NewSearchIcon = Instance.new(ButtonOrNot and "ImageButton" or "ImageLabel")
NewSearchIcon.Name = "SearchIcon"
NewSearchIcon.BackgroundTransparency = 1
NewSearchIcon.Image = IconLibraryID
NewSearchIcon.ImageRectOffset = Vector2.new(964,324)
NewSearchIcon.ImageRectSize = Vector2.new(36,36)
NewSearchIcon.Size = UDim2.new(0,16,0,16)
NewSearchIcon.Position = UDim2.new(0,2,0,2)
NewSearchIcon.ZIndex = Level
return NewSearchIcon
end
local function RoundBox(CornerRadius, ButtonOrNot)
local NewRoundBox = Instance.new(ButtonOrNot and "ImageButton" or "ImageLabel")
NewRoundBox.BackgroundTransparency = 1
NewRoundBox.Image = "rbxassetid://3570695787"
NewRoundBox.SliceCenter = Rect.new(100,100,100,100)
NewRoundBox.SliceScale = math.clamp((CornerRadius or 5) * 0.01, 0.01, 1)
NewRoundBox.ScaleType = Enum.ScaleType.Slice
NewRoundBox.ZIndex = Level
return NewRoundBox
end
local function DropShadow()
local NewDropShadow = Instance.new("ImageLabel")
NewDropShadow.Name = "DropShadow"
NewDropShadow.BackgroundTransparency = 1
NewDropShadow.Image = DropShadowID
NewDropShadow.ImageTransparency = DropShadowTransparency
NewDropShadow.Size = UDim2.new(1,0,1,0)
NewDropShadow.ZIndex = Level
return NewDropShadow
end
local function Frame()
local NewFrame = Instance.new("Frame")
NewFrame.BorderSizePixel = 0
NewFrame.ZIndex = Level
return NewFrame
end
local function ScrollingFrame()
local NewScrollingFrame = Instance.new("ScrollingFrame")
NewScrollingFrame.BackgroundTransparency = 1
NewScrollingFrame.BorderSizePixel = 0
NewScrollingFrame.ScrollBarThickness = 0
NewScrollingFrame.ZIndex = Level
return NewScrollingFrame
end
local function TextButton(Text, Size)
local NewTextButton = Instance.new("TextButton")
NewTextButton.Text = Text
NewTextButton.AutoButtonColor = false
NewTextButton.Font = MainFont
NewTextButton.TextColor3 = Color3.fromRGB(255,255,255)
NewTextButton.BackgroundTransparency = 1
NewTextButton.TextSize = Size or 12
NewTextButton.Size = UDim2.new(1,0,1,0)
NewTextButton.ZIndex = Level
return NewTextButton
end
local function TextBox(Text, Size)
local NewTextBox = Instance.new("TextBox")
NewTextBox.Text = Text
NewTextBox.Font = MainFont
NewTextBox.TextColor3 = Color3.fromRGB(255,255,255)
NewTextBox.BackgroundTransparency = 1
NewTextBox.TextSize = Size or 12
NewTextBox.Size = UDim2.new(1,0,1,0)
NewTextBox.ZIndex = Level
return NewTextBox
end
local function TextLabel(Text, Size)
local NewTextLabel = Instance.new("TextLabel")
NewTextLabel.Text = Text
NewTextLabel.Font = MainFont
NewTextLabel.TextColor3 = Color3.fromRGB(255,255,255)
NewTextLabel.BackgroundTransparency = 1
NewTextLabel.TextSize = Size or 12
NewTextLabel.Size = UDim2.new(1,0,1,0)
NewTextLabel.ZIndex = Level
return NewTextLabel
end
local function Tween(GuiObject, Dictionary)
local TweenBase = TweenService:Create(GuiObject, GlobalTweenInfo, Dictionary)
TweenBase:Play()
return TweenBase
end
local UILibrary = {}
function UILibrary.Load(GUITitle)
local TargetedParent = RunService:IsStudio() and Player:WaitForChild("PlayerGui") or CoreGuiService
local FindOldInstance = TargetedParent:FindFirstChild(GUITitle)
if FindOldInstance then
FindOldInstance:Destroy()
end
local NewInstance, ContainerFrame, ContainerShadow, MainFrame
NewInstance = Instance.new("ScreenGui")
NewInstance.Name = GUITitle
NewInstance.Parent = TargetedParent
ContainerFrame = Frame()
ContainerFrame.Name = "ContainerFrame"
ContainerFrame.Size = UDim2.new(0,500,0,300)
ContainerFrame.Position = UDim2.new(0.5,-250,0.5,-150)
ContainerFrame.BackgroundTransparency = 1
ContainerFrame.Parent = NewInstance
ContainerShadow = DropShadow()
ContainerShadow.Name = "Shadow"
ContainerShadow.Parent = ContainerFrame
Level += 1
MainFrame = RoundBox(5)
MainFrame.ClipsDescendants = true
MainFrame.Name = "MainFrame"
MainFrame.Size = UDim2.new(1,-50,1,-30)
MainFrame.Position = UDim2.new(0,25,0,15)
MainFrame.ImageColor3 = Color3.fromRGB(30,30,30)
MainFrame.Parent = ContainerFrame
local MenuBar, DisplayFrame, TitleBar
MenuBar = ScrollingFrame()
MenuBar.Name = "MenuBar"
MenuBar.BackgroundTransparency = 0.7
MenuBar.BackgroundColor3 = Color3.fromRGB(20,20,20)
MenuBar.Size = UDim2.new(0,100,0,235)
MenuBar.Position = UDim2.new(0,5,0,30)
MenuBar.CanvasSize = UDim2.new(0,0,0,0)
MenuBar.Parent = MainFrame
DisplayFrame = RoundBox(5)
DisplayFrame.Name = "Display"
DisplayFrame.ImageColor3 = Color3.fromRGB(20,20,20)
DisplayFrame.Size = UDim2.new(1,-115,0,235)
DisplayFrame.Position = UDim2.new(0,110,0,30)
DisplayFrame.Parent = MainFrame
TitleBar = RoundBox(5)
TitleBar.Name = "TitleBar"
TitleBar.ImageColor3 = Color3.fromRGB(40,40,40)
TitleBar.Size = UDim2.new(1,-10,0,20)
TitleBar.Position = UDim2.new(0,5,0,5)
TitleBar.Parent = MainFrame
Level += 1
local MinimiseButton, TitleButton
local MinimiseToggle = true
MinimiseButton = TitleIcon(true)
MinimiseButton.Name = "Minimise"
MinimiseButton.Parent = TitleBar
TitleButton = TextButton(GUITitle, 14)
TitleButton.Name = "TitleButton"
TitleButton.Size = UDim2.new(1,-20,1,0)
TitleButton.Parent = TitleBar
MinimiseButton.MouseButton1Down:Connect(function()
MinimiseToggle = not MinimiseToggle
if not MinimiseToggle then
Tween(MainFrame, {Size = UDim2.new(1,-50,0,30)})
Tween(MinimiseButton, {Rotation = 0})
Tween(ContainerShadow, {ImageTransparency = 1})
else
Tween(MainFrame, {Size = UDim2.new(1,-50,1,-30)})
Tween(MinimiseButton, {Rotation = 180})
Tween(ContainerShadow, {ImageTransparency = DropShadowTransparency})
end
end)
TitleButton.MouseButton1Down:Connect(function()
local LastMX, LastMY = Mouse.X, Mouse.Y
local Move, Kill
Move = Mouse.Move:Connect(function()
local NewMX, NewMY = Mouse.X, Mouse.Y
local DX, DY = NewMX - LastMX, NewMY - LastMY
ContainerFrame.Position += UDim2.new(0,DX,0,DY)
LastMX, LastMY = NewMX, NewMY
end)
Kill = UserInputService.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
Move:Disconnect()
Kill:Disconnect()
end
end)
end)
Level += 1
local MenuListLayout
MenuListLayout = Instance.new("UIListLayout")
MenuListLayout.SortOrder = Enum.SortOrder.LayoutOrder
MenuListLayout.Padding = UDim.new(0,5)
MenuListLayout.Parent = MenuBar
local TabCount = 0
local TabLibrary = {}
function TabLibrary.AddPage(PageTitle, SearchBarIncluded)
local SearchBarIncluded = (SearchBarIncluded == nil) and true or SearchBarIncluded
local PageContainer = RoundBox(5)
PageContainer.Name = PageTitle
PageContainer.Size = UDim2.new(1,0,0,20)
PageContainer.LayoutOrder = TabCount
PageContainer.ImageColor3 = (TabCount == 0) and Color3.fromRGB(50,50,50) or Color3.fromRGB(40,40,40)
PageContainer.Parent = MenuBar
local PageButton = TextButton(PageTitle, 14)
PageButton.Name = PageTitle.."Button"
PageButton.TextTransparency = (TabCount == 0) and 0 or 0.5
PageButton.Parent = PageContainer
PageButton.MouseButton1Down:Connect(function()
spawn(function()
for _, Button in next, MenuBar:GetChildren() do
if Button:IsA("GuiObject") then
local IsButton = string.find(Button.Name:lower(), PageContainer.Name:lower())
local Button2 = Button:FindFirstChild(Button.Name.."Button")
Tween(Button, {ImageColor3 = IsButton and Color3.fromRGB(50,50,50) or Color3.fromRGB(40,40,40)})
Tween(Button2, {TextTransparency = IsButton and 0 or 0.5})
end
end
end)
spawn(function()
for _, Display in next, DisplayFrame:GetChildren() do
if Display:IsA("GuiObject") then
Display.Visible = string.find(Display.Name:lower(), PageContainer.Name:lower())
end
end
end)
end)
local DisplayPage = ScrollingFrame()
DisplayPage.Visible = (TabCount == 0)
DisplayPage.Name = PageTitle
DisplayPage.Size = UDim2.new(1,0,1,0)
DisplayPage.Parent = DisplayFrame
TabCount += 1
local DisplayList = Instance.new("UIListLayout")
DisplayList.SortOrder = Enum.SortOrder.LayoutOrder
DisplayList.Padding = UDim.new(0,5)
DisplayList.Parent = DisplayPage
DisplayList:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
local Y1 = DisplayList.AbsoluteContentSize.Y
local Y2 = DisplayPage.AbsoluteWindowSize.Y
DisplayPage.CanvasSize = UDim2.new(0,0,(Y1/Y2)+0.05,0)
end)
local DisplayPadding = Instance.new("UIPadding")
DisplayPadding.PaddingBottom = UDim.new(0,5)
DisplayPadding.PaddingTop = UDim.new(0,5)
DisplayPadding.PaddingLeft = UDim.new(0,5)
DisplayPadding.PaddingRight = UDim.new(0,5)
DisplayPadding.Parent = DisplayPage
if SearchBarIncluded then
local SearchBarContainer = RoundBox(5)
SearchBarContainer.Name = "SearchBar"
SearchBarContainer.ImageColor3 = Color3.fromRGB(35,35,35)
SearchBarContainer.Size = UDim2.new(1,0,0,20)
SearchBarContainer.Parent = DisplayPage
local SearchBox = TextBox("Search...")
SearchBox.Name = "SearchInput"
SearchBox.Position = UDim2.new(0,20,0,0)
SearchBox.Size = UDim2.new(1,-20,1,0)
SearchBox.TextTransparency = 0.5
SearchBox.TextXAlignment = Enum.TextXAlignment.Left
SearchBox.Parent = SearchBarContainer
local SearchIcon = SearchIcon()
SearchIcon.Parent = SearchBarContainer
SearchBox:GetPropertyChangedSignal("Text"):Connect(function()
local NewValue = SearchBox.Text
for _, Element in next, DisplayPage:GetChildren() do
if Element:IsA("Frame") then
if not string.find(Element.Name:lower(), "label") then
if string.find(Element.Name:lower(), NewValue:lower()) then
Element.Visible = true
else
Element.Visible = false
end
end
end
end
end)
end
local PageLibrary = {}
function PageLibrary.AddButton(Text, Callback, Parent, Underline)
local ButtonContainer = Frame()
ButtonContainer.Name = Text.."BUTTON"
ButtonContainer.Size = UDim2.new(1,0,0,20)
ButtonContainer.BackgroundTransparency = 1
ButtonContainer.Parent = Parent or DisplayPage
local ButtonForeground = RoundBox(5)
ButtonForeground.Name = "ButtonForeground"
ButtonForeground.Size = UDim2.new(1,0,1,0)
ButtonForeground.ImageColor3 = Color3.fromRGB(35,35,35)
ButtonForeground.Parent = ButtonContainer
if Underline then
local TextSize = TextService:GetTextSize(Text, 12, Enum.Font.Gotham, Vector2.new(0,0))
local BottomEffect = Frame()
BottomEffect.Size = UDim2.new(0,TextSize.X,0,1)
BottomEffect.Position = UDim2.new(0.5,(-TextSize.X/2)-1,1,-1)
BottomEffect.BackgroundColor3 = Color3.fromRGB(255,255,255)
BottomEffect.BackgroundTransparency = 0.5
BottomEffect.Parent = ButtonForeground
end
local HiddenButton = TextButton(Text, 12)
HiddenButton.Parent = ButtonForeground
HiddenButton.MouseButton1Down:Connect(function()
Callback()
Tween(ButtonForeground, {ImageColor3 = Color3.fromRGB(45,45,45)})
Tween(HiddenButton, {TextTransparency = 0.5})
wait(TweenTime)
Tween(ButtonForeground, {ImageColor3 = Color3.fromRGB(35,35,35)})
Tween(HiddenButton, {TextTransparency = 0})
end)
end
function PageLibrary.AddLabel(Text)
local LabelContainer = Frame()
LabelContainer.Name = Text.."LABEL"
LabelContainer.Size = UDim2.new(1,0,0,20)
LabelContainer.BackgroundTransparency = 1
LabelContainer.Parent = DisplayPage
local LabelForeground = RoundBox(5)
LabelForeground.Name = "LabelForeground"
LabelForeground.ImageColor3 = Color3.fromRGB(45,45,45)
LabelForeground.Size = UDim2.new(1,0,1,0)
LabelForeground.Parent = LabelContainer
local HiddenLabel = TextLabel(Text, 12)
HiddenLabel.Parent = LabelForeground
end
function PageLibrary.AddDropdown(Text, ConfigurationArray, Callback)
local DropdownArray = ConfigurationArray or {}
local DropdownToggle = false
local DropdownContainer = Frame()
DropdownContainer.Size = UDim2.new(1,0,0,20)
DropdownContainer.Name = Text.."DROPDOWN"
DropdownContainer.BackgroundTransparency = 1
DropdownContainer.Parent = DisplayPage
local DropdownForeground = RoundBox(5)
DropdownForeground.ClipsDescendants = true
DropdownForeground.ImageColor3 = Color3.fromRGB(35,35,35)
DropdownForeground.Size = UDim2.new(1,0,1,0)
DropdownForeground.Parent = DropdownContainer
local DropdownExpander = DropdownIcon(true)
DropdownExpander.Parent = DropdownForeground
local DropdownLabel = TextLabel(Text, 12)
DropdownLabel.Size = UDim2.new(1,0,0,20)
DropdownLabel.Parent = DropdownForeground
local DropdownFrame = Frame()
DropdownFrame.Position = UDim2.new(0,0,0,20)
DropdownFrame.BackgroundTransparency = 1
DropdownFrame.Size = UDim2.new(1,0,0,#DropdownArray*20)
DropdownFrame.Parent = DropdownForeground
local DropdownList = Instance.new("UIListLayout")
DropdownList.Parent = DropdownFrame
for OptionIndex, Option in next, DropdownArray do
PageLibrary.AddButton(Option, function()
Callback(Option)
DropdownLabel.Text = Text..": "..Option
end, DropdownFrame, OptionIndex < #DropdownArray)
end
DropdownExpander.MouseButton1Down:Connect(function()
DropdownToggle = not DropdownToggle
Tween(DropdownContainer, {Size = DropdownToggle and UDim2.new(1,0,0,20+(#DropdownArray*20)) or UDim2.new(1,0,0,20)})
Tween(DropdownExpander, {Rotation = DropdownToggle and 135 or 0})
end)
end
function PageLibrary.AddColourPicker(Text, DefaultColour, Callback)
local DefaultColour = DefaultColour or Color3.fromRGB(255,255,255)
local ColourDictionary = {
white = Color3.fromRGB(255,255,255),
black = Color3.fromRGB(0,0,0),
red = Color3.fromRGB(255,0,0),
green = Color3.fromRGB(0,255,0),
blue = Color3.fromRGB(0,0,255)
}
if typeof(DefaultColour) == "table" then
DefaultColour = Color3.fromRGB(DefaultColour[1] or 255, DefaultColour[2] or 255, DefaultColour[3] or 255)
elseif typeof(DefaultColour) == "string" then
DefaultColour = ColourDictionary[DefaultColour:lower()] or ColourDictionary["white"]
end
local PickerContainer = Frame()
PickerContainer.ClipsDescendants = true
PickerContainer.Size = UDim2.new(1,0,0,20)
PickerContainer.Name = Text.."COLOURPICKER"
PickerContainer.BackgroundTransparency = 1
PickerContainer.Parent = DisplayPage
local ColourTracker = Instance.new("Color3Value")
ColourTracker.Value = DefaultColour
ColourTracker.Parent = PickerContainer
local PickerLeftSide, PickerRightSide, PickerFrame = RoundBox(5), RoundBox(5), RoundBox(5)
PickerLeftSide.Size = UDim2.new(1,-22,1,0)
PickerLeftSide.ImageColor3 = Color3.fromRGB(35,35,35)
PickerLeftSide.Parent = PickerContainer
PickerRightSide.Size = UDim2.new(0,20,1,0)
PickerRightSide.Position = UDim2.new(1,-20,0,0)
PickerRightSide.ImageColor3 = DefaultColour
PickerRightSide.Parent = PickerContainer
PickerFrame.ImageColor3 = Color3.fromRGB(35,35,35)
PickerFrame.Size = UDim2.new(1,-22,0,60)
PickerFrame.Position = UDim2.new(0,0,0,20)
PickerFrame.Parent = PickerContainer
local PickerList = Instance.new("UIListLayout")
PickerList.SortOrder = Enum.SortOrder.LayoutOrder
PickerList.Parent = PickerFrame
local RedPicker = PageLibrary.AddSlider("R", {Min = 0, Max = 255, Def = ColourTracker.Value.R * 255}, function(Value)
ColourTracker.Value = Color3.fromRGB(Value, ColourTracker.Value.G * 255, ColourTracker.Value.B * 255)
Callback(ColourTracker.Value)
end, PickerFrame)
local BluePicker = PageLibrary.AddSlider("G", {Min = 0, Max = 255, Def = ColourTracker.Value.G * 255}, function(Value)
ColourTracker.Value = Color3.fromRGB(ColourTracker.Value.R * 255, Value, ColourTracker.Value.B * 255)
Callback(ColourTracker.Value)
end, PickerFrame)
local GreenPicker = PageLibrary.AddSlider("B", {Min = 0, Max = 255, Def = ColourTracker.Value.B * 255}, function(Value)
ColourTracker.Value = Color3.fromRGB(ColourTracker.Value.R * 255, ColourTracker.Value.G * 255, Value)
Callback(ColourTracker.Value)
end, PickerFrame)
local EffectLeft, EffectRight = Frame(), Frame()
EffectLeft.BackgroundColor3 = Color3.fromRGB(35,35,35)
EffectLeft.Position = UDim2.new(1,-5,0,0)
EffectLeft.Size = UDim2.new(0,5,1,0)
EffectLeft.Parent = PickerLeftSide
EffectRight.BackgroundColor3 = DefaultColour
EffectRight.Size = UDim2.new(0,5,1,0)
EffectRight.Parent = PickerRightSide
local PickerLabel = TextLabel(Text, 12)
PickerLabel.Size = UDim2.new(1,0,0,20)
PickerLabel.Parent = PickerLeftSide
ColourTracker:GetPropertyChangedSignal("Value"):Connect(function()
local NewValue = ColourTracker.Value
EffectRight.BackgroundColor3 = NewValue
PickerRightSide.ImageColor3 = NewValue
end)
local PickerToggle = false
local PickerButton = TextButton("")
PickerButton.Parent = PickerRightSide
PickerButton.MouseButton1Down:Connect(function()
PickerToggle = not PickerToggle
Tween(PickerContainer, {Size = PickerToggle and UDim2.new(1,0,0,80) or UDim2.new(1,0,0,20)})
end)
end
function PageLibrary.AddSlider(Text, ConfigurationDictionary, Callback, Parent)
local Configuration = ConfigurationDictionary
local Minimum = Configuration.Minimum or Configuration.minimum or Configuration.Min or Configuration.min
local Maximum = Configuration.Maximum or Configuration.maximum or Configuration.Max or Configuration.max
local Default = Configuration.Default or Configuration.default or Configuration.Def or Configuration.def
if Minimum > Maximum then
local StoreValue = Minimum
Minimum = Maximum
Maximum = StoreValue
end
Default = math.clamp(Default, Minimum, Maximum)
local DefaultScale = Default/Maximum
local SliderContainer = Frame()
SliderContainer.Name = Text.."SLIDER"
SliderContainer.Size = UDim2.new(1,0,0,20)
SliderContainer.BackgroundTransparency = 1
SliderContainer.Parent = Parent or DisplayPage
local SliderForeground = RoundBox(5)
SliderForeground.Name = "SliderForeground"
SliderForeground.ImageColor3 = Color3.fromRGB(35,35,35)
SliderForeground.Size = UDim2.new(1,0,1,0)
SliderForeground.Parent = SliderContainer
local SliderButton = TextButton(Text..": "..Default)
SliderButton.Size = UDim2.new(1,0,1,0)
SliderButton.ZIndex = 6
SliderButton.Parent = SliderForeground
local SliderFill = RoundBox(5)
SliderFill.Size = UDim2.new(DefaultScale,0,1,0)
SliderFill.ImageColor3 = Color3.fromRGB(70,70,70)
SliderFill.ZIndex = 5
SliderFill.ImageTransparency = 0.7
SliderFill.Parent = SliderButton
SliderButton.MouseButton1Down:Connect(function()
Tween(SliderFill, {ImageTransparency = 0.5})
local X, Y, XScale, YScale = GetXY(SliderButton)
local Value = math.floor(Minimum + ((Maximum - Minimum) * XScale))
Callback(Value)
SliderButton.Text = Text..": "..tostring(Value)
local TargetSize = UDim2.new(XScale,0,1,0)
Tween(SliderFill, {Size = TargetSize})
local SliderMove, SliderKill
SliderMove = Mouse.Move:Connect(function()
Tween(SliderFill, {ImageTransparency = 0.5})
local X, Y, XScale, YScale = GetXY(SliderButton)
local Value = math.floor(Minimum + ((Maximum - Minimum) * XScale))
Callback(Value)
SliderButton.Text = Text..": "..tostring(Value)
local TargetSize = UDim2.new(XScale,0,1,0)
Tween(SliderFill, {Size = TargetSize})
end)
SliderKill = UserInputService.InputEnded:Connect(function(UserInput)
if UserInput.UserInputType == Enum.UserInputType.MouseButton1 then
Tween(SliderFill, {ImageTransparency = 0.7})
SliderMove:Disconnect()
SliderKill:Disconnect()
end
end)
end)
end
function PageLibrary.AddToggle(Text, Default, Callback)
local ThisToggle = Default or false
local ToggleContainer = Frame()
ToggleContainer.Name = Text.."TOGGLE"
ToggleContainer.Size = UDim2.new(1,0,0,20)
ToggleContainer.BackgroundTransparency = 1
ToggleContainer.Parent = DisplayPage
local ToggleLeftSide, ToggleRightSide, EffectFrame, RightTick = RoundBox(5), RoundBox(5), Frame(), TickIcon()
local FlatLeft, FlatRight = Frame(), Frame()
ToggleLeftSide.Size = UDim2.new(1,-22,1,0)
ToggleLeftSide.ImageColor3 = Color3.fromRGB(35,35,35)
ToggleLeftSide.Parent = ToggleContainer
ToggleRightSide.Position = UDim2.new(1,-20,0,0)
ToggleRightSide.Size = UDim2.new(0,20,1,0)
ToggleRightSide.ImageColor3 = Color3.fromRGB(45,45,45)
ToggleRightSide.Parent = ToggleContainer
FlatLeft.BackgroundColor3 = Color3.fromRGB(35,35,35)
FlatLeft.Size = UDim2.new(0,5,1,0)
FlatLeft.Position = UDim2.new(1,-5,0,0)
FlatLeft.Parent = ToggleLeftSide
FlatRight.BackgroundColor3 = Color3.fromRGB(45,45,45)
FlatRight.Size = UDim2.new(0,5,1,0)
FlatRight.Parent = ToggleRightSide
EffectFrame.BackgroundColor3 = ThisToggle and Color3.fromRGB(0,255,109) or Color3.fromRGB(255,160,160)
EffectFrame.Position = UDim2.new(1,-22,0.2,0)
EffectFrame.Size = UDim2.new(0,2,0.6,0)
EffectFrame.Parent = ToggleContainer
RightTick.ImageTransparency = ThisToggle and 0 or 1
RightTick.Parent = ToggleRightSide
local ToggleButton = TextButton(Text, 12)
ToggleButton.Name = "ToggleButton"
ToggleButton.Size = UDim2.new(1,0,1,0)
ToggleButton.Parent = ToggleLeftSide
ToggleButton.MouseButton1Down:Connect(function()
ThisToggle = not ThisToggle
Tween(EffectFrame, {BackgroundColor3 = ThisToggle and Color3.fromRGB(0,255,109) or Color3.fromRGB(255,160,160)})
Tween(RightTick, {ImageTransparency = ThisToggle and 0 or 1})
Callback(ThisToggle)
end)
end
return PageLibrary
end
return TabLibrary
end
return UILibrary