-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModern-Library
More file actions
975 lines (844 loc) · 36.4 KB
/
Modern-Library
File metadata and controls
975 lines (844 loc) · 36.4 KB
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
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
local ModernTab = {}
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local PlayerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
-- Default settings
ModernTab.Settings = {
MainColor = Color3.fromRGB(25, 25, 25),
Transparency = 0.25,
Size = UDim2.new(0, 350, 0, 400),
MinSize = UDim2.new(0, 350, 0, 40),
Position = UDim2.new(0.5, -175, 0.5, -200),
Title = "MODERN TAB",
ToggleKey = Enum.KeyCode.Y,
Notifications = true,
Minimized = false,
Draggable = true,
NotificationPosition = UDim2.new(1, -260, 1, -90)
}
-- UI elements table
ModernTab.Elements = {}
ModernTab.Dragging = false
ModernTab.DragStart = nil
ModernTab.DragInput = nil
ModernTab.DragStartPosition = nil
-- Animated notification function
function ModernTab:Notify(title, message, duration)
if not self.Settings.Notifications then return end
local notifyGui = Instance.new("ScreenGui")
notifyGui.Name = "Notification"
notifyGui.Parent = PlayerGui
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 250, 0, 80)
frame.Position = self.Settings.NotificationPosition
frame.AnchorPoint = Vector2.new(1, 1)
frame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
frame.BackgroundTransparency = 0.3
frame.BorderSizePixel = 0
frame.Parent = notifyGui
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 8)
corner.Parent = frame
local uiStroke = Instance.new("UIStroke")
uiStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
uiStroke.Color = Color3.fromRGB(100, 100, 100)
uiStroke.LineJoinMode = Enum.LineJoinMode.Round
uiStroke.Thickness = 1
uiStroke.Transparency = 0.7
uiStroke.Parent = frame
local titleLabel = Instance.new("TextLabel")
titleLabel.Text = title
titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
titleLabel.TextSize = 14
titleLabel.Font = Enum.Font.GothamBold
titleLabel.BackgroundTransparency = 1
titleLabel.Position = UDim2.new(0, 10, 0, 5)
titleLabel.Size = UDim2.new(1, -20, 0, 20)
titleLabel.TextXAlignment = Enum.TextXAlignment.Left
titleLabel.Parent = frame
local messageLabel = Instance.new("TextLabel")
messageLabel.Text = message
messageLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
messageLabel.TextSize = 12
messageLabel.Font = Enum.Font.Gotham
messageLabel.BackgroundTransparency = 1
messageLabel.Position = UDim2.new(0, 10, 0, 30)
messageLabel.Size = UDim2.new(1, -20, 1, -40)
messageLabel.TextXAlignment = Enum.TextXAlignment.Left
messageLabel.TextYAlignment = Enum.TextYAlignment.Top
messageLabel.TextWrapped = true
messageLabel.Parent = frame
-- Entrance animation
frame.Position = UDim2.new(1, 300, 1, -90)
frame.BackgroundTransparency = 1
titleLabel.TextTransparency = 1
messageLabel.TextTransparency = 1
local fadeIn = TweenService:Create(frame, TweenInfo.new(0.3), {BackgroundTransparency = 0.3, Position = self.Settings.NotificationPosition})
local textFadeIn = TweenService:Create(titleLabel, TweenInfo.new(0.3), {TextTransparency = 0})
local messageFadeIn = TweenService:Create(messageLabel, TweenInfo.new(0.3), {TextTransparency = 0})
fadeIn:Play()
textFadeIn:Play()
messageFadeIn:Play()
-- Auto close after duration
delay(duration or 3, function()
local fadeOut = TweenService:Create(frame, TweenInfo.new(0.3), {BackgroundTransparency = 1, Position = UDim2.new(1, 300, 1, -90)})
local textFadeOut = TweenService:Create(titleLabel, TweenInfo.new(0.3), {TextTransparency = 1})
local messageFadeOut = TweenService:Create(messageLabel, TweenInfo.new(0.3), {TextTransparency = 1})
fadeOut:Play()
textFadeOut:Play()
messageFadeOut:Play()
fadeOut.Completed:Wait()
notifyGui:Destroy()
end)
end
-- Create tab function
function ModernTab:Create()
-- Clean previous UI
if PlayerGui:FindFirstChild("ModernTabUI") then
PlayerGui.ModernTabUI:Destroy()
end
-- Main UI
self.Elements.Main = Instance.new("ScreenGui")
self.Elements.Main.Name = "ModernTabUI"
self.Elements.Main.ResetOnSpawn = false
self.Elements.Main.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
self.Elements.Main.Parent = PlayerGui
-- Main frame
self.Elements.MainFrame = Instance.new("Frame")
self.Elements.MainFrame.Name = "MainFrame"
self.Elements.MainFrame.BackgroundColor3 = self.Settings.MainColor
self.Elements.MainFrame.BackgroundTransparency = self.Settings.Transparency
self.Elements.MainFrame.BorderSizePixel = 0
self.Elements.MainFrame.Position = self.Settings.Position
self.Elements.MainFrame.Size = UDim2.new(0, 0, 0, 0)
self.Elements.MainFrame.AnchorPoint = Vector2.new(0.5, 0.5)
self.Elements.MainFrame.Visible = false
self.Elements.MainFrame.Parent = self.Elements.Main
-- Corner rounding
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 12)
corner.Parent = self.Elements.MainFrame
-- Title bar
self.Elements.TitleBar = Instance.new("Frame")
self.Elements.TitleBar.Name = "TitleBar"
self.Elements.TitleBar.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
self.Elements.TitleBar.BackgroundTransparency = 0.3
self.Elements.TitleBar.BorderSizePixel = 0
self.Elements.TitleBar.Size = UDim2.new(1, 0, 0, 30)
self.Elements.TitleBar.Parent = self.Elements.MainFrame
local titleCorner = Instance.new("UICorner")
titleCorner.CornerRadius = UDim.new(0, 12)
titleCorner.Parent = self.Elements.TitleBar
self.Elements.Title = Instance.new("TextLabel")
self.Elements.Title.Name = "Title"
self.Elements.Title.Text = self.Settings.Title
self.Elements.Title.TextColor3 = Color3.fromRGB(255, 255, 255)
self.Elements.Title.TextSize = 14
self.Elements.Title.Font = Enum.Font.GothamBold
self.Elements.Title.BackgroundTransparency = 1
self.Elements.Title.Position = UDim2.new(0, 10, 0, 0)
self.Elements.Title.Size = UDim2.new(1, -80, 1, 0)
self.Elements.Title.Parent = self.Elements.TitleBar
-- Close button (X)
self.Elements.CloseButton = Instance.new("TextButton")
self.Elements.CloseButton.Name = "CloseButton"
self.Elements.CloseButton.Text = "✕"
self.Elements.CloseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
self.Elements.CloseButton.TextSize = 16
self.Elements.CloseButton.Font = Enum.Font.GothamBold
self.Elements.CloseButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
self.Elements.CloseButton.BackgroundTransparency = 0.7
self.Elements.CloseButton.Position = UDim2.new(1, -30, 0, 0)
self.Elements.CloseButton.Size = UDim2.new(0, 30, 0, 30)
self.Elements.CloseButton.Parent = self.Elements.TitleBar
local closeCorner = Instance.new("UICorner")
closeCorner.CornerRadius = UDim.new(0, 12)
closeCorner.Parent = self.Elements.CloseButton
-- Minimize button (-)
self.Elements.MinimizeButton = Instance.new("TextButton")
self.Elements.MinimizeButton.Name = "MinimizeButton"
self.Elements.MinimizeButton.Text = "-"
self.Elements.MinimizeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
self.Elements.MinimizeButton.TextSize = 16
self.Elements.MinimizeButton.Font = Enum.Font.GothamBold
self.Elements.MinimizeButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
self.Elements.MinimizeButton.BackgroundTransparency = 0.7
self.Elements.MinimizeButton.Position = UDim2.new(1, -60, 0, 0)
self.Elements.MinimizeButton.Size = UDim2.new(0, 30, 0, 30)
self.Elements.MinimizeButton.Parent = self.Elements.TitleBar
local minimizeCorner = Instance.new("UICorner")
minimizeCorner.CornerRadius = UDim.new(0, 12)
minimizeCorner.Parent = self.Elements.MinimizeButton
-- Content area
self.Elements.ContentFrame = Instance.new("Frame")
self.Elements.ContentFrame.Name = "ContentFrame"
self.Elements.ContentFrame.BackgroundTransparency = 1
self.Elements.ContentFrame.Position = UDim2.new(0, 0, 0, 35)
self.Elements.ContentFrame.Size = UDim2.new(1, 0, 1, -35)
self.Elements.ContentFrame.Parent = self.Elements.MainFrame
-- Tab buttons area
self.Elements.TabButtons = Instance.new("Frame")
self.Elements.TabButtons.Name = "TabButtons"
self.Elements.TabButtons.BackgroundTransparency = 1
self.Elements.TabButtons.Size = UDim2.new(1, 0, 0, 30)
self.Elements.TabButtons.Parent = self.Elements.ContentFrame
-- Tab contents area
self.Elements.TabContents = Instance.new("Frame")
self.Elements.TabContents.Name = "TabContents"
self.Elements.TabContents.BackgroundTransparency = 1
self.Elements.TabContents.Position = UDim2.new(0, 0, 0, 35)
self.Elements.TabContents.Size = UDim2.new(1, 0, 1, -35)
self.Elements.TabContents.Parent = self.Elements.ContentFrame
-- Button interactions
self.Elements.CloseButton.MouseEnter:Connect(function()
TweenService:Create(
self.Elements.CloseButton,
TweenInfo.new(0.2),
{BackgroundTransparency = 0.4}
):Play()
end)
self.Elements.CloseButton.MouseLeave:Connect(function()
TweenService:Create(
self.Elements.CloseButton,
TweenInfo.new(0.2),
{BackgroundTransparency = 0.7}
):Play()
end)
self.Elements.CloseButton.MouseButton1Click:Connect(function()
self:Close()
end)
-- Minimize button interactions
self.Elements.MinimizeButton.MouseEnter:Connect(function()
TweenService:Create(
self.Elements.MinimizeButton,
TweenInfo.new(0.2),
{BackgroundTransparency = 0.4}
):Play()
end)
self.Elements.MinimizeButton.MouseLeave:Connect(function()
TweenService:Create(
self.Elements.MinimizeButton,
TweenInfo.new(0.2),
{BackgroundTransparency = 0.7}
):Play()
end)
self.Elements.MinimizeButton.MouseButton1Click:Connect(function()
self:ToggleMinimize()
end)
-- Dragging functionality
if self.Settings.Draggable then
local function updateDrag(input)
local delta = input.Position - self.DragStart
local newPosition = UDim2.new(
self.DragStartPosition.X.Scale,
self.DragStartPosition.X.Offset + delta.X,
self.DragStartPosition.Y.Scale,
self.DragStartPosition.Y.Offset + delta.Y
)
self.Elements.MainFrame.Position = newPosition
end
self.Elements.TitleBar.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
self.Dragging = true
self.DragStart = input.Position
self.DragStartPosition = self.Elements.MainFrame.Position
-- Ripple effect
local ripple = Instance.new("Frame")
ripple.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
ripple.BackgroundTransparency = 0.8
ripple.Size = UDim2.new(0, 0, 0, 0)
ripple.Position = UDim2.new(0, input.Position.X - self.Elements.TitleBar.AbsolutePosition.X, 0, 0)
ripple.AnchorPoint = Vector2.new(0.5, 0.5)
ripple.Parent = self.Elements.TitleBar
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(1, 0)
corner.Parent = ripple
TweenService:Create(ripple, TweenInfo.new(0.5), {
Size = UDim2.new(2, 0, 10, 0),
Position = UDim2.new(0.5, 0, 0.5, 0),
BackgroundTransparency = 1
}):Play()
game:GetService("Debris"):AddItem(ripple, 0.5)
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then
self.Dragging = false
end
end)
end
end)
self.Elements.TitleBar.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
self.DragInput = input
end
end)
UserInputService.InputChanged:Connect(function(input)
if input == self.DragInput and self.Dragging then
updateDrag(input)
end
end)
end
-- Toggle with key
local toggleConnection
toggleConnection = UserInputService.InputBegan:Connect(function(input, gameProcessed)
if not gameProcessed and input.KeyCode == self.Settings.ToggleKey then
if self.Elements.MainFrame.Visible then
self:Close()
else
self:Open()
end
end
end)
self.Elements.Main.Destroying:Connect(function()
toggleConnection:Disconnect()
end)
return self
end
-- Open tab function
function ModernTab:Open()
self.Elements.MainFrame.Size = UDim2.new(0, 0, 0, 0)
self.Elements.MainFrame.Visible = true
local targetSize = self.Settings.Minimized and self.Settings.MinSize or self.Settings.Size
local openTween = TweenService:Create(
self.Elements.MainFrame,
TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.Out),
{Size = targetSize}
)
openTween:Play()
if self.Settings.Notifications then
self:Notify("Info", "Tab menu opened", 2)
end
end
-- Close tab function
function ModernTab:Close()
local closeTween = TweenService:Create(
self.Elements.MainFrame,
TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.In),
{Size = UDim2.new(0, 0, 0, 0)}
)
closeTween:Play()
if self.Settings.Notifications then
self:Notify("Info", "Tab menu closed", 2)
end
closeTween.Completed:Connect(function()
self.Elements.Main:Destroy()
end)
end
-- Toggle minimize function
function ModernTab:ToggleMinimize()
self.Settings.Minimized = not self.Settings.Minimized
local targetSize = self.Settings.Minimized and self.Settings.MinSize or self.Settings.Size
local minimizeTween = TweenService:Create(
self.Elements.MainFrame,
TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{Size = targetSize}
)
minimizeTween:Play()
-- Show/hide content
self.Elements.ContentFrame.Visible = not self.Settings.Minimized
if self.Settings.Notifications then
local message = self.Settings.Minimized and "Tab menu minimized" or "Tab menu restored"
self:Notify("Info", message, 1)
end
end
-- Change title function
function ModernTab:SetTitle(newTitle)
self.Settings.Title = newTitle
if self.Elements.Title then
self.Elements.Title.Text = newTitle
end
end
-- Add new tab
function ModernTab:AddTab(tabName)
local tabButton = Instance.new("TextButton")
tabButton.Name = tabName .. "TabButton"
tabButton.Text = tabName
tabButton.TextColor3 = Color3.fromRGB(255, 255, 255)
tabButton.TextSize = 12
tabButton.Font = Enum.Font.Gotham
tabButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
tabButton.BackgroundTransparency = 0.7
tabButton.Size = UDim2.new(0.3, 0, 1, 0)
tabButton.Position = UDim2.new(#self.Elements.TabButtons:GetChildren() * 0.3, 5, 0, 0)
tabButton.Parent = self.Elements.TabButtons
local tabCorner = Instance.new("UICorner")
tabCorner.CornerRadius = UDim.new(0, 6)
tabCorner.Parent = tabButton
local tabContent = Instance.new("ScrollingFrame")
tabContent.Name = tabName .. "Content"
tabContent.BackgroundTransparency = 1
tabContent.Size = UDim2.new(1, 0, 1, 0)
tabContent.Visible = false
tabContent.ScrollingDirection = Enum.ScrollingDirection.Y
tabContent.ScrollBarThickness = 4
tabContent.AutomaticCanvasSize = Enum.AutomaticSize.Y
tabContent.Parent = self.Elements.TabContents
local tabContentLayout = Instance.new("UIListLayout")
tabContentLayout.Padding = UDim.new(0, 5)
tabContentLayout.Parent = tabContent
-- Button interactions
tabButton.MouseEnter:Connect(function()
TweenService:Create(
tabButton,
TweenInfo.new(0.2),
{BackgroundTransparency = 0.5}
):Play()
end)
tabButton.MouseLeave:Connect(function()
TweenService:Create(
tabButton,
TweenInfo.new(0.2),
{BackgroundTransparency = 0.7}
):Play()
end)
tabButton.MouseButton1Click:Connect(function()
for _, content in ipairs(self.Elements.TabContents:GetChildren()) do
if content:IsA("ScrollingFrame") then
content.Visible = false
end
end
tabContent.Visible = true
end)
-- First tab is active by default
if #self.Elements.TabButtons:GetChildren() == 1 then
tabContent.Visible = true
end
local tab = {}
function tab:AddButton(buttonName, callback)
local button = Instance.new("TextButton")
button.Name = buttonName
button.Text = buttonName
button.TextColor3 = Color3.fromRGB(255, 255, 255)
button.TextSize = 12
button.Font = Enum.Font.Gotham
button.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
button.BackgroundTransparency = 0.5
button.Size = UDim2.new(1, -20, 0, 30)
button.Position = UDim2.new(0, 10, 0, #tabContent:GetChildren() * 35 + 10)
button.Parent = tabContent
local buttonCorner = Instance.new("UICorner")
buttonCorner.CornerRadius = UDim.new(0, 6)
buttonCorner.Parent = button
-- Button interactions
button.MouseEnter:Connect(function()
TweenService:Create(
button,
TweenInfo.new(0.2),
{BackgroundTransparency = 0.3, TextColor3 = Color3.fromRGB(200, 200, 255)}
):Play()
end)
button.MouseLeave:Connect(function()
TweenService:Create(
button,
TweenInfo.new(0.2),
{BackgroundTransparency = 0.5, TextColor3 = Color3.fromRGB(255, 255, 255)}
):Play()
end)
button.MouseButton1Click:Connect(function()
if callback then
callback()
end
end)
end
function tab:AddLabel(text)
local label = Instance.new("TextLabel")
label.Name = "Label_" .. #tabContent:GetChildren()
label.Text = text
label.TextColor3 = Color3.fromRGB(255, 255, 255)
label.TextSize = 12
label.Font = Enum.Font.Gotham
label.BackgroundTransparency = 1
label.Size = UDim2.new(1, -20, 0, 20)
label.Position = UDim2.new(0, 10, 0, #tabContent:GetChildren() * 25 + 10)
label.TextXAlignment = Enum.TextXAlignment.Left
label.Parent = tabContent
end
function tab:AddParagraph(title, content)
local container = Instance.new("Frame")
container.Name = "Paragraph_" .. #tabContent:GetChildren()
container.BackgroundTransparency = 1
container.Size = UDim2.new(1, -20, 0, 50)
container.Position = UDim2.new(0, 10, 0, #tabContent:GetChildren() * 55 + 10)
container.Parent = tabContent
local titleLabel = Instance.new("TextLabel")
titleLabel.Text = title
titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
titleLabel.TextSize = 12
titleLabel.Font = Enum.Font.GothamBold
titleLabel.BackgroundTransparency = 1
titleLabel.Size = UDim2.new(1, 0, 0, 20)
titleLabel.TextXAlignment = Enum.TextXAlignment.Left
titleLabel.Parent = container
local contentLabel = Instance.new("TextLabel")
contentLabel.Text = content
contentLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
contentLabel.TextSize = 11
contentLabel.Font = Enum.Font.Gotham
contentLabel.BackgroundTransparency = 1
contentLabel.Position = UDim2.new(0, 0, 0, 20)
contentLabel.Size = UDim2.new(1, 0, 0, 30)
contentLabel.TextXAlignment = Enum.TextXAlignment.Left
contentLabel.TextYAlignment = Enum.TextYAlignment.Top
contentLabel.TextWrapped = true
contentLabel.Parent = container
end
function tab:AddToggle(name, default, callback)
local toggleFrame = Instance.new("Frame")
toggleFrame.Name = "Toggle_" .. name
toggleFrame.BackgroundTransparency = 1
toggleFrame.Size = UDim2.new(1, -20, 0, 30)
toggleFrame.Position = UDim2.new(0, 10, 0, #tabContent:GetChildren() * 35 + 10)
toggleFrame.Parent = tabContent
local toggleLabel = Instance.new("TextLabel")
toggleLabel.Name = "Label"
toggleLabel.Text = name
toggleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
toggleLabel.TextSize = 12
toggleLabel.Font = Enum.Font.Gotham
toggleLabel.BackgroundTransparency = 1
toggleLabel.Size = UDim2.new(0.7, 0, 1, 0)
toggleLabel.TextXAlignment = Enum.TextXAlignment.Left
toggleLabel.Parent = toggleFrame
local toggleButton = Instance.new("TextButton")
toggleButton.Name = "ToggleButton"
toggleButton.Text = ""
toggleButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
toggleButton.BackgroundTransparency = 0.5
toggleButton.Size = UDim2.new(0, 50, 0, 25)
toggleButton.Position = UDim2.new(1, -50, 0.5, -12.5)
toggleButton.AnchorPoint = Vector2.new(1, 0.5)
toggleButton.Parent = toggleFrame
local toggleCorner = Instance.new("UICorner")
toggleCorner.CornerRadius = UDim.new(0, 12)
toggleCorner.Parent = toggleButton
local toggleState = Instance.new("Frame")
toggleState.Name = "State"
toggleState.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
toggleState.Size = UDim2.new(0, 21, 0, 21)
toggleState.Position = default and UDim2.new(1, -23, 0.5, -10.5) or UDim2.new(0, 2, 0.5, -10.5)
toggleState.AnchorPoint = Vector2.new(1, 0.5)
toggleState.Parent = toggleButton
local stateCorner = Instance.new("UICorner")
stateCorner.CornerRadius = UDim.new(0, 12)
stateCorner.Parent = toggleState
local currentState = default or false
local function updateToggle()
if currentState then
TweenService:Create(
toggleState,
TweenInfo.new(0.2),
{
Position = UDim2.new(1, -23, 0.5, -10.5),
BackgroundColor3 = Color3.fromRGB(100, 255, 100)
}
):Play()
TweenService:Create(
toggleButton,
TweenInfo.new(0.2),
{BackgroundColor3 = Color3.fromRGB(100, 255, 100)}
):Play()
else
TweenService:Create(
toggleState,
TweenInfo.new(0.2),
{
Position = UDim2.new(0, 2, 0.5, -10.5),
BackgroundColor3 = Color3.fromRGB(255, 255, 255)
}
):Play()
TweenService:Create(
toggleButton,
TweenInfo.new(0.2),
{BackgroundColor3 = Color3.fromRGB(60, 60, 60)}
):Play()
end
end
updateToggle()
toggleButton.MouseButton1Click:Connect(function()
currentState = not currentState
updateToggle()
if callback then
callback(currentState)
end
end)
return {
Set = function(self, value)
currentState = value
updateToggle()
end,
Get = function(self)
return currentState
end
}
end
function tab:AddSlider(name, min, max, default, callback)
local sliderFrame = Instance.new("Frame")
sliderFrame.Name = "Slider_" .. name
sliderFrame.BackgroundTransparency = 1
sliderFrame.Size = UDim2.new(1, -20, 0, 50)
sliderFrame.Position = UDim2.new(0, 10, 0, #tabContent:GetChildren() * 55 + 10)
sliderFrame.Parent = tabContent
local sliderLabel = Instance.new("TextLabel")
sliderLabel.Name = "Label"
sliderLabel.Text = name
sliderLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
sliderLabel.TextSize = 12
sliderLabel.Font = Enum.Font.Gotham
sliderLabel.BackgroundTransparency = 1
sliderLabel.Size = UDim2.new(1, 0, 0, 20)
sliderLabel.TextXAlignment = Enum.TextXAlignment.Left
sliderLabel.Parent = sliderFrame
local sliderValue = Instance.new("TextLabel")
sliderValue.Name = "Value"
sliderValue.Text = tostring(default or min)
sliderValue.TextColor3 = Color3.fromRGB(200, 200, 200)
sliderValue.TextSize = 12
sliderValue.Font = Enum.Font.Gotham
sliderValue.BackgroundTransparency = 1
sliderValue.Size = UDim2.new(0.3, 0, 0, 20)
sliderValue.Position = UDim2.new(1, -30, 0, 0)
sliderValue.TextXAlignment = Enum.TextXAlignment.Right
sliderValue.Parent = sliderFrame
local sliderBar = Instance.new("Frame")
sliderBar.Name = "Bar"
sliderBar.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
sliderBar.BackgroundTransparency = 0.5
sliderBar.Size = UDim2.new(1, 0, 0, 5)
sliderBar.Position = UDim2.new(0, 0, 1, -15)
sliderBar.Parent = sliderFrame
local sliderBarCorner = Instance.new("UICorner")
sliderBarCorner.CornerRadius = UDim.new(0, 3)
sliderBarCorner.Parent = sliderBar
local sliderFill = Instance.new("Frame")
sliderFill.Name = "Fill"
sliderFill.BackgroundColor3 = Color3.fromRGB(100, 200, 255)
sliderFill.Size = UDim2.new((default or min - min) / (max - min), 0, 1, 0)
sliderFill.Parent = sliderBar
local sliderFillCorner = Instance.new("UICorner")
sliderFillCorner.CornerRadius = UDim.new(0, 3)
sliderFillCorner.Parent = sliderFill
local sliderButton = Instance.new("TextButton")
sliderButton.Name = "Button"
sliderButton.Text = ""
sliderButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
sliderButton.Size = UDim2.new(0, 15, 0, 15)
sliderButton.Position = UDim2.new((default or min - min) / (max - min), -7.5, 0.5, -7.5)
sliderButton.AnchorPoint = Vector2.new(0, 0.5)
sliderButton.Parent = sliderBar
local sliderButtonCorner = Instance.new("UICorner")
sliderButtonCorner.CornerRadius = UDim.new(1, 0)
sliderButtonCorner.Parent = sliderButton
local dragging = false
local currentValue = default or min
local function updateSlider(value)
value = math.clamp(value, min, max)
currentValue = value
sliderValue.Text = tostring(math.floor(value * 100) / 100)
sliderFill.Size = UDim2.new((value - min) / (max - min), 0, 1, 0)
sliderButton.Position = UDim2.new((value - min) / (max - min), -7.5, 0.5, -7.5)
if callback then
callback(value)
end
end
sliderButton.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
dragging = true
-- Ripple effect
local ripple = Instance.new("Frame")
ripple.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
ripple.BackgroundTransparency = 0.8
ripple.Size = UDim2.new(0, 0, 0, 0)
ripple.Position = UDim2.new(0.5, 0, 0.5, 0)
ripple.AnchorPoint = Vector2.new(0.5, 0.5)
ripple.Parent = sliderButton
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(1, 0)
corner.Parent = ripple
TweenService:Create(ripple, TweenInfo.new(0.5), {
Size = UDim2.new(2, 0, 2, 0),
BackgroundTransparency = 1
}):Play()
game:GetService("Debris"):AddItem(ripple, 0.5)
end
end)
sliderButton.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
dragging = false
end
end)
UserInputService.InputChanged:Connect(function(input)
if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
local xScale = (input.Position.X - sliderBar.AbsolutePosition.X) / sliderBar.AbsoluteSize.X
xScale = math.clamp(xScale, 0, 1)
local value = min + (max - min) * xScale
updateSlider(value)
end
end)
return {
Set = function(self, value)
updateSlider(value)
end,
Get = function(self)
return currentValue
end
}
end
function tab:AddDropdown(name, options, default, callback)
local dropdownFrame = Instance.new("Frame")
dropdownFrame.Name = "Dropdown_" .. name
dropdownFrame.BackgroundTransparency = 1
dropdownFrame.Size = UDim2.new(1, -20, 0, 30)
dropdownFrame.Position = UDim2.new(0, 10, 0, #tabContent:GetChildren() * 35 + 10)
dropdownFrame.Parent = tabContent
local dropdownLabel = Instance.new("TextLabel")
dropdownLabel.Name = "Label"
dropdownLabel.Text = name
dropdownLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
dropdownLabel.TextSize = 12
dropdownLabel.Font = Enum.Font.Gotham
dropdownLabel.BackgroundTransparency = 1
dropdownLabel.Size = UDim2.new(0.5, 0, 1, 0)
dropdownLabel.TextXAlignment = Enum.TextXAlignment.Left
dropdownLabel.Parent = dropdownFrame
local dropdownButton = Instance.new("TextButton")
dropdownButton.Name = "Button"
dropdownButton.Text = options[default or 1] or "Select"
dropdownButton.TextColor3 = Color3.fromRGB(255, 255, 255)
dropdownButton.TextSize = 12
dropdownButton.Font = Enum.Font.Gotham
dropdownButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
dropdownButton.BackgroundTransparency = 0.5
dropdownButton.Size = UDim2.new(0.5, 0, 1, 0)
dropdownButton.Position = UDim2.new(0.5, 0, 0, 0)
dropdownButton.Parent = dropdownFrame
local dropdownCorner = Instance.new("UICorner")
dropdownCorner.CornerRadius = UDim.new(0, 6)
dropdownCorner.Parent = dropdownButton
local dropdownList = Instance.new("ScrollingFrame")
dropdownList.Name = "List"
dropdownList.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
dropdownList.BackgroundTransparency = 0.1
dropdownList.Size = UDim2.new(0.5, 0, 0, 0)
dropdownList.Position = UDim2.new(0.5, 0, 1, 5)
dropdownList.Visible = false
dropdownList.ScrollBarThickness = 4
dropdownList.AutomaticCanvasSize = Enum.AutomaticSize.Y
dropdownList.Parent = dropdownFrame
local dropdownListLayout = Instance.new("UIListLayout")
dropdownListLayout.Padding = UDim.new(0, 2)
dropdownListLayout.Parent = dropdownList
local dropdownListCorner = Instance.new("UICorner")
dropdownListCorner.CornerRadius = UDim.new(0, 6)
dropdownListCorner.Parent = dropdownList
local currentSelection = default or 1
local isOpen = false
local function updateDropdown()
dropdownButton.Text = options[currentSelection] or "Select"
if callback then
callback(currentSelection, options[currentSelection])
end
end
local function toggleDropdown()
isOpen = not isOpen
dropdownList.Visible = isOpen
if isOpen then
TweenService:Create(
dropdownList,
TweenInfo.new(0.2),
{Size = UDim2.new(0.5, 0, 0, math.min(#options * 25 + 5, 150))}
):Play()
else
TweenService:Create(
dropdownList,
TweenInfo.new(0.2),
{Size = UDim2.new(0.5, 0, 0, 0)}
):Play()
end
end
for i, option in ipairs(options) do
local optionButton = Instance.new("TextButton")
optionButton.Name = "Option_" .. i
optionButton.Text = option
optionButton.TextColor3 = Color3.fromRGB(255, 255, 255)
optionButton.TextSize = 12
optionButton.Font = Enum.Font.Gotham
optionButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
optionButton.BackgroundTransparency = 0.7
optionButton.Size = UDim2.new(1, -10, 0, 25)
optionButton.Position = UDim2.new(0, 5, 0, (i-1)*27)
optionButton.Parent = dropdownList
local optionCorner = Instance.new("UICorner")
optionCorner.CornerRadius = UDim.new(0, 4)
optionCorner.Parent = optionButton
optionButton.MouseButton1Click:Connect(function()
currentSelection = i
updateDropdown()
toggleDropdown()
end)
end
dropdownButton.MouseButton1Click:Connect(function()
toggleDropdown()
end)
updateDropdown()
return {
Set = function(self, index)
if index >= 1 and index <= #options then
currentSelection = index
updateDropdown()
end
end,
Get = function(self)
return currentSelection, options[currentSelection]
end
}
end
function tab:AddTextBox(name, placeholder, callback)
local textboxFrame = Instance.new("Frame")
textboxFrame.Name = "Textbox_" .. name
textboxFrame.BackgroundTransparency = 1
textboxFrame.Size = UDim2.new(1, -20, 0, 50)
textboxFrame.Position = UDim2.new(0, 10, 0, #tabContent:GetChildren() * 55 + 10)
textboxFrame.Parent = tabContent
local textboxLabel = Instance.new("TextLabel")
textboxLabel.Name = "Label"
textboxLabel.Text = name
textboxLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
textboxLabel.TextSize = 12
textboxLabel.Font = Enum.Font.Gotham
textboxLabel.BackgroundTransparency = 1
textboxLabel.Size = UDim2.new(1, 0, 0, 20)
textboxLabel.TextXAlignment = Enum.TextXAlignment.Left
textboxLabel.Parent = textboxFrame
local textbox = Instance.new("TextBox")
textbox.Name = "Input"
textbox.PlaceholderText = placeholder or "Type here..."
textbox.Text = ""
textbox.TextColor3 = Color3.fromRGB(255, 255, 255)
textbox.TextSize = 12
textbox.Font = Enum.Font.Gotham
textbox.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
textbox.BackgroundTransparency = 0.5
textbox.Size = UDim2.new(1, 0, 0, 30)
textbox.Position = UDim2.new(0, 0, 1, -30)
textbox.Parent = textboxFrame
local textboxCorner = Instance.new("UICorner")
textboxCorner.CornerRadius = UDim.new(0, 6)
textboxCorner.Parent = textbox
textbox.FocusLost:Connect(function(enterPressed)
if enterPressed and callback then
callback(textbox.Text)
end
end)
return {
Set = function(self, text)
textbox.Text = text
end,
Get = function(self)
return textbox.Text
end
}
end
return tab
end
return ModernTab