-
Notifications
You must be signed in to change notification settings - Fork 0
/
ImGui.lua
1378 lines (1160 loc) · 61.2 KB
/
ImGui.lua
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
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
local util = {}
function util:egg(stringx)
local output = {}
for i = 1, #stringx do
local charCode = string.byte(stringx, i)
local egged = ""
for j = 1, math.random(5, 10) do
egged = egged .. string.char(math.random(32, 126))
end
output[#output+1] = string.format("%03d%s", charCode, egged)
end
return table.concat(output)
end
local main = {}
function main:Begin(PROPS)
if not PROPS then
return
end
warn("This is an alpha release of imgui-rbx, expect way more elements being added in later updates! cya");
warn("(also expect some bugs)");
local MenuOptions = PROPS or {
Name = PROPS.Name or "imgui-rbx | alpha 0.1",
Width = PROPS.Width or 574,
Height = PROPS.Height or 350
}
local function SecureGui(gui_element)
if (syn and syn.protect_gui) then
syn.protect_gui(gui_element)
gui_element.Parent = game:GetService("PlayerGui")
elseif gethui then
gui_element.Parent = gethui()
else
error("Cannot secure GUI, it's unsafe to continue.");
gui_element.Parent = game:GetService("Players").LocalPlayer.PlayerGui
end
end
local function GetFont()
return Font.fromId(12187374954)
end
local ImGui = Instance.new("ScreenGui")
local Window = Instance.new("Frame")
local WindowCorner = Instance.new("UICorner")
local WindowPanel = Instance.new("Frame")
local WindowPanelIcon = Instance.new("ImageLabel")
local MinimiseButton = Instance.new("TextButton")
local MinimiseButtonIcon = Instance.new("ImageLabel")
local WindowPanelIconPadding = Instance.new("UIPadding")
local WindowDisplayName = Instance.new("TextLabel")
local WindowDisplayNamePadding = Instance.new("UIPadding")
local ResizeAll = Instance.new("TextButton")
local ResizeAllIcon = Instance.new("ImageLabel")
local WindowElementContainer = Instance.new("Frame")
local WindowElements = Instance.new("ScrollingFrame")
local WindowElementsLayout = Instance.new("UIListLayout")
local WindowElementsPadding = Instance.new("UIPadding")
local WindowElementsContainerLayout = Instance.new("UIListLayout")
local AWindowSep = Instance.new("Frame")
ImGui.Name = string.format("ImGui-%s", tostring(util:egg(tostring(game:GetService("Players").LocalPlayer.UserId))))
ImGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
ImGui.ResetOnSpawn = false
SecureGui(ImGui)
Window.Name = "Window"
Window.Parent = ImGui
Window.Active = true
Window.BackgroundColor3 = Color3.fromRGB(21, 22, 23)
Window.BackgroundTransparency = 0.050
Window.ClipsDescendants = true
Window.Position = UDim2.new(0.283211678, 0, 0.155285195, 0)
Window.Selectable = true
Window.Size = UDim2.new(0, MenuOptions.Width, 0, MenuOptions.Height)
WindowCorner.CornerRadius = UDim.new(0, 9)
WindowCorner.Name = "WindowCorner"
WindowCorner.Parent = Window
WindowPanel.Name = "WindowPanel"
WindowPanel.Parent = Window
WindowPanel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
WindowPanel.BackgroundTransparency = 1.000
WindowPanel.Size = UDim2.new(1, 0, 0, 25)
WindowPanel.ZIndex = 2
WindowPanelIcon.Name = "WindowPanelIcon"
WindowPanelIcon.Parent = WindowPanel
WindowPanelIcon.AnchorPoint = Vector2.new(0.5, 0.5)
WindowPanelIcon.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
WindowPanelIcon.BackgroundTransparency = 1.000
WindowPanelIcon.Position = UDim2.new(0.5, 0, 0.5, 0)
WindowPanelIcon.Size = UDim2.new(0.999999881, 0, 1, 0)
WindowPanelIcon.ZIndex = 2
WindowPanelIcon.Image = "rbxassetid://13034670565"
WindowPanelIcon.ScaleType = Enum.ScaleType.Tile
MinimiseButton.Name = "MinimiseButton"
MinimiseButton.Parent = WindowPanelIcon
MinimiseButton.AnchorPoint = Vector2.new(0.5, 0.5)
MinimiseButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
MinimiseButton.BackgroundTransparency = 1.000
MinimiseButton.Position = UDim2.new(0, 13, 0.5, 0)
MinimiseButton.Size = UDim2.new(0.0452961661, 0, 1, 0)
MinimiseButton.FontFace = GetFont()
MinimiseButton.Text = ""
MinimiseButton.TextColor3 = Color3.fromRGB(0, 0, 0)
MinimiseButton.TextSize = 14.000
MinimiseButtonIcon.Name = "MinimiseButtonIcon"
MinimiseButtonIcon.Parent = MinimiseButton
MinimiseButtonIcon.AnchorPoint = Vector2.new(0.5, 0.5)
MinimiseButtonIcon.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
MinimiseButtonIcon.BackgroundTransparency = 1.000
MinimiseButtonIcon.Position = UDim2.new(0.5, 0, 0.5, 2)
MinimiseButtonIcon.Size = UDim2.new(0, 12, 0, 12)
MinimiseButtonIcon.Image = "rbxassetid://13034875812"
WindowPanelIconPadding.Name = "WindowPanelIconPadding"
WindowPanelIconPadding.Parent = WindowPanelIcon
WindowPanelIconPadding.PaddingLeft = UDim.new(0, 2)
WindowDisplayName.Name = "WindowDisplayName"
WindowDisplayName.Parent = WindowPanelIcon
WindowDisplayName.AnchorPoint = Vector2.new(0.5, 0.5)
WindowDisplayName.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
WindowDisplayName.BackgroundTransparency = 1.000
WindowDisplayName.Position = UDim2.new(0.5, 0, 0.5, 0)
WindowDisplayName.Size = UDim2.new(1, 0, 1, 0)
WindowDisplayName.FontFace = Font.fromId(12187362578)
WindowDisplayName.Text = PROPS.Name
WindowDisplayName.TextColor3 = Color3.fromRGB(225, 225, 225)
WindowDisplayName.TextSize = 16.000
WindowDisplayName.TextXAlignment = Enum.TextXAlignment.Left
WindowDisplayNamePadding.Name = "WindowDisplayNamePadding"
WindowDisplayNamePadding.Parent = WindowDisplayName
WindowDisplayNamePadding.PaddingLeft = UDim.new(0, 30)
ResizeAll.Name = "ResizeAll"
ResizeAll.Parent = Window
ResizeAll.AnchorPoint = Vector2.new(0.5, 0.5)
ResizeAll.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
ResizeAll.BackgroundTransparency = 1.000
ResizeAll.BorderSizePixel = 0
ResizeAll.Position = UDim2.new(0, 563, 0, 339)
ResizeAll.Size = UDim2.new(0, 22, 0, 22)
ResizeAll.FontFace = GetFont()
ResizeAll.Text = ""
ResizeAll.TextColor3 = Color3.fromRGB(0, 0, 0)
ResizeAll.TextSize = 14.000
ResizeAll.ZIndex = 2
ResizeAllIcon.Name = "ResizeAllIcon"
ResizeAllIcon.Parent = ResizeAll
ResizeAllIcon.AnchorPoint = Vector2.new(0.5, 0.5)
ResizeAllIcon.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
ResizeAllIcon.BackgroundTransparency = 1.000
ResizeAllIcon.Position = UDim2.new(0.5, 0, 0.5, 0)
ResizeAllIcon.Size = UDim2.new(1.06818187, 0, 1, 0)
ResizeAllIcon.ZIndex = -1
ResizeAllIcon.Image = "rbxassetid://13034819689"
WindowElementContainer.Name = "WindowElementContainer"
WindowElementContainer.Parent = Window
WindowElementContainer.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
WindowElementContainer.BackgroundTransparency = 1.000
WindowElementContainer.Size = UDim2.new(1, 0, 1, 0)
WindowElements.Name = "WindowElements"
WindowElements.Parent = WindowElementContainer
WindowElements.Active = true
WindowElements.AnchorPoint = Vector2.new(0.5, 0.5)
WindowElements.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
WindowElements.BackgroundTransparency = 1.000
WindowElements.BorderSizePixel = 0
WindowElements.Position = UDim2.new(0.5, 0, 0.54285717, 0)
WindowElements.Size = UDim2.new(1, -5, 0.914285719, 0)
WindowElements.CanvasSize = UDim2.new(0, 0, 0, 0)
WindowElements.ScrollBarThickness = 10
WindowElementsLayout.Name = "WindowElementsLayout"
WindowElementsLayout.Parent = WindowElements
WindowElementsLayout.SortOrder = Enum.SortOrder.LayoutOrder
WindowElementsLayout.Padding = UDim.new(0, 6)
WindowElementsPadding.Name = "WindowElementsPadding"
WindowElementsPadding.Parent = WindowElements
WindowElementsPadding.PaddingBottom = UDim.new(0, 15)
WindowElementsPadding.PaddingLeft = UDim.new(0, 7)
WindowElementsPadding.PaddingRight = UDim.new(0, 20)
WindowElementsPadding.PaddingTop = UDim.new(0, 10)
WindowElementsContainerLayout.Name = "WindowElementsContainerLayout"
WindowElementsContainerLayout.Parent = WindowElementContainer
WindowElementsContainerLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
AWindowSep.Name = "AWindowSep"
AWindowSep.Parent = WindowElementContainer
AWindowSep.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
AWindowSep.BackgroundTransparency = 1.000
AWindowSep.Position = UDim2.new(0.00609756075, 0, 0, 0)
AWindowSep.Size = UDim2.new(0, 567, 0, 25)
local ElementHandler = {}
function ElementHandler:Text(TextDisplay)
local Label_Element = Instance.new("TextLabel")
Label_Element.Name = "Label_Element"
Label_Element.Parent = WindowElements
Label_Element.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Label_Element.BackgroundTransparency = 1.000
Label_Element.Size = UDim2.new(1, 0, 0, 20)
Label_Element.FontFace = GetFont()
Label_Element.Text = TextDisplay
Label_Element.TextColor3 = Color3.fromRGB(255, 255, 255)
Label_Element.TextSize = 17.000
Label_Element.TextXAlignment = Enum.TextXAlignment.Left
end
function ElementHandler:Button(TextDisplay)
local Button_Element = Instance.new("TextButton")
local Button_ElementPadding = Instance.new("UIPadding")
local OnClick = {}
Button_Element.Name = "Button_Element"
Button_Element.Parent = WindowElements
Button_Element.BackgroundColor3 = Color3.fromRGB(41, 74, 122)
Button_Element.BorderColor3 = Color3.fromRGB(74, 74, 83)
Button_Element.Position = UDim2.new(0, 0, 0.0833333358, 0)
Button_Element.Size = UDim2.new(0, 21, 0, 23)
Button_Element.FontFace = GetFont()
Button_Element.Text = TextDisplay
Button_Element.TextColor3 = Color3.fromRGB(255, 255, 255)
Button_Element.TextSize = 17.000
Button_ElementPadding.Name = "Button_ElementPadding"
Button_ElementPadding.Parent = Button_Element
Button_ElementPadding.PaddingLeft = UDim.new(0, 6)
Button_ElementPadding.PaddingRight = UDim.new(0, 6)
Button_Element.Activated:Connect(function(inputObject, clickCount)
if inputObject.UserInputType.Name == "MouseButton1" then
return true
end
end)
function OnClick:Connect(Function)
Button_Element.MouseButton1Click:Connect(Function)
end
local box = Button_Element
local text = box.Text
local size = box.TextBounds.X
if game:IsLoaded() then box.Size = UDim2.new(0, size + 20, 0, 23) end
return OnClick
end
function ElementHandler:InputText(InputTextOptions)
local TextBox_Element = Instance.new("Frame")
local TextBox_ElementName = Instance.new("TextLabel")
local TextBox_ElementLayout = Instance.new("UIListLayout")
local TextBox_ElementInput = Instance.new("TextBox")
local TextBox_ElementInputPadding = Instance.new("UIPadding")
TextBox_Element.Name = "TextBox_Element"
TextBox_Element.Parent = WindowElements
TextBox_Element.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TextBox_Element.BackgroundTransparency = 1.000
TextBox_Element.Size = UDim2.new(1, 0, 0, 23)
TextBox_ElementName.Name = "TextBox_ElementName"
TextBox_ElementName.Parent = TextBox_Element
TextBox_ElementName.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TextBox_ElementName.BackgroundTransparency = 1.000
TextBox_ElementName.Position = UDim2.new(2.21000004, 0, 0, 0)
TextBox_ElementName.Size = UDim2.new(1, 0, 0.0299999993, 20)
TextBox_ElementName.FontFace = GetFont()
TextBox_ElementName.Text = InputTextOptions.Name
TextBox_ElementName.TextColor3 = Color3.fromRGB(255, 255, 255)
TextBox_ElementName.TextSize = 17.000
TextBox_ElementName.TextXAlignment = Enum.TextXAlignment.Left
TextBox_ElementLayout.Name = "TextBox_ElementLayout"
TextBox_ElementLayout.Parent = TextBox_Element
TextBox_ElementLayout.FillDirection = Enum.FillDirection.Horizontal
TextBox_ElementLayout.Padding = UDim.new(0, 7)
TextBox_ElementInput.Name = "TextBox_ElementInput"
TextBox_ElementInput.Parent = TextBox_Element
TextBox_ElementInput.BackgroundColor3 = Color3.fromRGB(41, 74, 122)
TextBox_ElementInput.BorderColor3 = Color3.fromRGB(74, 74, 83)
TextBox_ElementInput.ClipsDescendants = true
TextBox_ElementInput.Size = UDim2.new(0.300000012, 0, 1, 0)
TextBox_ElementInput.ClearTextOnFocus = false
TextBox_ElementInput.FontFace = GetFont()
TextBox_ElementInput.PlaceholderColor3 = Color3.fromRGB(255, 255, 255)
TextBox_ElementInput.ShowNativeInput = false
TextBox_ElementInput.Text = ""
TextBox_ElementInput.TextColor3 = Color3.fromRGB(221, 221, 221)
TextBox_ElementInput.TextSize = 16.000
TextBox_ElementInput.TextXAlignment = Enum.TextXAlignment.Left
TextBox_ElementInputPadding.Name = "TextBox_ElementInputPadding"
TextBox_ElementInputPadding.Parent = TextBox_ElementInput
TextBox_ElementInputPadding.PaddingLeft = UDim.new(0, 5)
TextBox_ElementInputPadding.PaddingRight = UDim.new(0, 5)
TextBox_ElementInput.FocusLost:Connect(function(enterPressed, inputThatCausedFocusLoss)
if enterPressed then
pcall(InputTextOptions.OnEnter, TextBox_ElementInput.Text)
end
end)
end
function ElementHandler:SliderFloat(SliderOptions)
local Slider_Element = Instance.new("Frame")
local Slider_ElementFrame = Instance.new("Frame")
local Slider_ElementSelector = Instance.new("Frame")
local Slider_ElementValue = Instance.new("TextLabel")
local Slider_ElementOnInput = Instance.new("TextButton")
local Slider_ElementName = Instance.new("TextLabel")
local Slider_ElementLayout = Instance.new("UIListLayout")
Slider_Element.Name = "Slider_Element"
Slider_Element.Parent = WindowElements
Slider_Element.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Slider_Element.BackgroundTransparency = 1.000
Slider_Element.Size = UDim2.new(1, 0, 0, 23)
Slider_ElementFrame.Name = "Slider_ElementFrame"
Slider_ElementFrame.Parent = Slider_Element
Slider_ElementFrame.BackgroundColor3 = Color3.fromRGB(41, 74, 122)
Slider_ElementFrame.BorderColor3 = Color3.fromRGB(74, 74, 83)
Slider_ElementFrame.ClipsDescendants = true
Slider_ElementFrame.Size = UDim2.new(0.300000012, 0, -3.34800005, 100)
Slider_ElementSelector.Name = "Slider_ElementSelector"
Slider_ElementSelector.Parent = Slider_ElementFrame
Slider_ElementSelector.AnchorPoint = Vector2.new(0.5, 0.5)
Slider_ElementSelector.BackgroundColor3 = Color3.fromRGB(70, 128, 209)
Slider_ElementSelector.BackgroundTransparency = 0.150
Slider_ElementSelector.BorderSizePixel = 0
Slider_ElementSelector.Position = UDim2.new(0, 10, 0.5, 0)
Slider_ElementSelector.Size = UDim2.new(0, 13, 0, 21)
Slider_ElementValue.Name = "Slider_ElementValue"
Slider_ElementValue.Parent = Slider_ElementFrame
Slider_ElementValue.AnchorPoint = Vector2.new(0.5, 0.5)
Slider_ElementValue.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Slider_ElementValue.BackgroundTransparency = 1.000
Slider_ElementValue.Position = UDim2.new(0.5, 0, 0.5, 0)
Slider_ElementValue.Size = UDim2.new(1, 0, 1, 0)
Slider_ElementValue.FontFace = GetFont()
Slider_ElementValue.LineHeight = 0.930
Slider_ElementValue.Text = SliderOptions.Default
Slider_ElementValue.TextColor3 = Color3.fromRGB(217, 217, 217)
Slider_ElementValue.TextSize = 17.000
Slider_ElementOnInput.Name = "Slider_ElementOnInput"
Slider_ElementOnInput.Parent = Slider_ElementFrame
Slider_ElementOnInput.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Slider_ElementOnInput.BackgroundTransparency = 1.000
Slider_ElementOnInput.Size = UDim2.new(1, 0, 1, 0)
Slider_ElementOnInput.FontFace = GetFont()
Slider_ElementOnInput.Text = ""
Slider_ElementOnInput.TextColor3 = Color3.fromRGB(0, 0, 0)
Slider_ElementOnInput.TextSize = 14.000
Slider_ElementName.Name = "Slider_ElementName"
Slider_ElementName.Parent = Slider_Element
Slider_ElementName.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Slider_ElementName.BackgroundTransparency = 1.000
Slider_ElementName.Position = UDim2.new(2.21000004, 0, 0, 0)
Slider_ElementName.Size = UDim2.new(1, 0, 0.0299999993, 20)
Slider_ElementName.FontFace = GetFont()
Slider_ElementName.Text = SliderOptions.Name
Slider_ElementName.TextColor3 = Color3.fromRGB(255, 255, 255)
Slider_ElementName.TextSize = 17.000
Slider_ElementName.TextXAlignment = Enum.TextXAlignment.Left
Slider_ElementLayout.Name = "Slider_ElementLayout"
Slider_ElementLayout.Parent = Slider_Element
Slider_ElementLayout.FillDirection = Enum.FillDirection.Horizontal
Slider_ElementLayout.Padding = UDim.new(0, 7)
local UserInputService = game:GetService("UserInputService")
local minValue = SliderOptions.Min
local maxValue = SliderOptions.Max
local decimalPlaces = 3
local defaultValue = SliderOptions.Default
local function updateSlider(input)
local sliderWidth = Slider_ElementOnInput.AbsoluteSize.X - 10
local sliderPosition = math.clamp(input.Position.X - (Slider_ElementOnInput.AbsolutePosition.X + 5), 0, sliderWidth) / sliderWidth
local sliderValue = minValue + (maxValue - minValue) * sliderPosition
-- Check if the slider selector has reached the start of the slider
if sliderPosition <= 0 then
sliderPosition = 0
sliderValue = minValue
-- Check if the slider selector has reached the end of the slider
elseif sliderPosition >= 1 then
sliderPosition = 1
sliderValue = maxValue
else
-- The slider is in the middle of the track, so update the slider value accordingly
sliderValue = minValue + (maxValue - minValue) * sliderPosition
end
Slider_ElementValue.Text = string.format("%."..decimalPlaces.."f", sliderValue)
Slider_ElementSelector.Position = UDim2.new(sliderPosition, 0, 0.5, 0)
pcall(SliderOptions.OnChanged, sliderValue)
end
local function setSliderValue(value)
value = math.clamp(value, minValue, maxValue)
local sliderPosition = (value - minValue) / (maxValue - minValue)
Slider_ElementValue.Text = string.format("%."..decimalPlaces.."f", value)
Slider_ElementSelector.Position = UDim2.new(sliderPosition, 0, 0.5, 0)
end
setSliderValue(defaultValue)
local dragging = false
Slider_ElementOnInput.MouseButton1Down:Connect(function()
dragging = true
end)
Slider_ElementOnInput.MouseButton1Up:Connect(function()
dragging = false
end)
Slider_ElementFrame.MouseLeave:Connect(function()
dragging = false
end)
UserInputService.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement and dragging then
updateSlider(input)
end
end)
end
function ElementHandler:SliderInteger(SliderOptions)
local Slider_Element = Instance.new("Frame")
local Slider_ElementFrame = Instance.new("Frame")
local Slider_ElementSelector = Instance.new("Frame")
local Slider_ElementValue = Instance.new("TextLabel")
local Slider_ElementOnInput = Instance.new("TextButton")
local Slider_ElementName = Instance.new("TextLabel")
local Slider_ElementLayout = Instance.new("UIListLayout")
Slider_Element.Name = "Slider_Element"
Slider_Element.Parent = WindowElements
Slider_Element.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Slider_Element.BackgroundTransparency = 1.000
Slider_Element.Size = UDim2.new(1, 0, 0, 23)
Slider_ElementFrame.Name = "Slider_ElementFrame"
Slider_ElementFrame.Parent = Slider_Element
Slider_ElementFrame.BackgroundColor3 = Color3.fromRGB(41, 74, 122)
Slider_ElementFrame.BorderColor3 = Color3.fromRGB(74, 74, 83)
Slider_ElementFrame.ClipsDescendants = true
Slider_ElementFrame.Size = UDim2.new(0.300000012, 0, -3.34800005, 100)
Slider_ElementSelector.Name = "Slider_ElementSelector"
Slider_ElementSelector.Parent = Slider_ElementFrame
Slider_ElementSelector.AnchorPoint = Vector2.new(0.5, 0.5)
Slider_ElementSelector.BackgroundColor3 = Color3.fromRGB(70, 128, 209)
Slider_ElementSelector.BackgroundTransparency = 0.150
Slider_ElementSelector.BorderSizePixel = 0
Slider_ElementSelector.Position = UDim2.new(0, 10, 0.5, 0)
Slider_ElementSelector.Size = UDim2.new(0, 13, 0, 21)
Slider_ElementValue.Name = "Slider_ElementValue"
Slider_ElementValue.Parent = Slider_ElementFrame
Slider_ElementValue.AnchorPoint = Vector2.new(0.5, 0.5)
Slider_ElementValue.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Slider_ElementValue.BackgroundTransparency = 1.000
Slider_ElementValue.Position = UDim2.new(0.5, 0, 0.5, 0)
Slider_ElementValue.Size = UDim2.new(1, 0, 1, 0)
Slider_ElementValue.FontFace = GetFont()
Slider_ElementValue.LineHeight = 0.930
Slider_ElementValue.Text = SliderOptions.Default
Slider_ElementValue.TextColor3 = Color3.fromRGB(217, 217, 217)
Slider_ElementValue.TextSize = 17.000
Slider_ElementOnInput.Name = "Slider_ElementOnInput"
Slider_ElementOnInput.Parent = Slider_ElementFrame
Slider_ElementOnInput.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Slider_ElementOnInput.BackgroundTransparency = 1.000
Slider_ElementOnInput.Size = UDim2.new(1, 0, 1, 0)
Slider_ElementOnInput.FontFace = GetFont()
Slider_ElementOnInput.Text = ""
Slider_ElementOnInput.TextColor3 = Color3.fromRGB(0, 0, 0)
Slider_ElementOnInput.TextSize = 14.000
Slider_ElementName.Name = "Slider_ElementName"
Slider_ElementName.Parent = Slider_Element
Slider_ElementName.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Slider_ElementName.BackgroundTransparency = 1.000
Slider_ElementName.Position = UDim2.new(2.21000004, 0, 0, 0)
Slider_ElementName.Size = UDim2.new(1, 0, 0.0299999993, 20)
Slider_ElementName.FontFace = GetFont()
Slider_ElementName.Text = SliderOptions.Name
Slider_ElementName.TextColor3 = Color3.fromRGB(255, 255, 255)
Slider_ElementName.TextSize = 17.000
Slider_ElementName.TextXAlignment = Enum.TextXAlignment.Left
Slider_ElementLayout.Name = "Slider_ElementLayout"
Slider_ElementLayout.Parent = Slider_Element
Slider_ElementLayout.FillDirection = Enum.FillDirection.Horizontal
Slider_ElementLayout.Padding = UDim.new(0, 7)
local UserInputService = game:GetService("UserInputService")
local minValue = SliderOptions.Min
local maxValue = SliderOptions.Max
local decimalPlaces = 0
local defaultValue = SliderOptions.Default
local function updateSlider(input)
local sliderWidth = Slider_ElementOnInput.AbsoluteSize.X - 10
local sliderPosition = math.clamp(input.Position.X - (Slider_ElementOnInput.AbsolutePosition.X + 5), 0, sliderWidth) / sliderWidth
local sliderValue = minValue + (maxValue - minValue) * sliderPosition
-- Check if the slider selector has reached the start of the slider
if sliderPosition <= 0 then
sliderPosition = 0
sliderValue = minValue
-- Check if the slider selector has reached the end of the slider
elseif sliderPosition >= 1 then
sliderPosition = 1
sliderValue = maxValue
else
-- The slider is in the middle of the track, so update the slider value accordingly
sliderValue = math.floor(minValue + (maxValue - minValue) * sliderPosition)
end
Slider_ElementValue.Text = string.format("%."..decimalPlaces.."f", sliderValue)
Slider_ElementSelector.Position = UDim2.new(sliderPosition, 0, 0.5, 0)
pcall(SliderOptions.OnChanged, sliderValue)
end
local function setSliderValue(value)
value = math.clamp(value, minValue, maxValue)
local sliderPosition = (value - minValue) / (maxValue - minValue)
Slider_ElementValue.Text = string.format("%."..decimalPlaces.."f", value)
Slider_ElementSelector.Position = UDim2.new(sliderPosition, 0, 0.5, 0)
end
setSliderValue(defaultValue)
local dragging = false
Slider_ElementOnInput.MouseButton1Down:Connect(function()
dragging = true
end)
Slider_ElementOnInput.MouseButton1Up:Connect(function()
dragging = false
end)
Slider_ElementFrame.MouseLeave:Connect(function()
dragging = false
end)
UserInputService.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement and dragging then
updateSlider(input)
end
end)
end
function ElementHandler:CheckBox(CheckBoxOptions)
local CheckBox_Element = Instance.new("Frame")
local CheckBox_ElementLayout = Instance.new("UIListLayout")
local CheckBox_ElementBox = Instance.new("Frame")
local CheckBox_ElementBoxInput = Instance.new("TextButton")
local CheckBox_ElementImage = Instance.new("ImageLabel")
local CheckBox_ElementName = Instance.new("TextLabel")
local Enabled = CheckBoxOptions.Enabled
CheckBox_Element.Name = "CheckBox_Element"
CheckBox_Element.Parent = WindowElements
CheckBox_Element.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
CheckBox_Element.BackgroundTransparency = 1.000
CheckBox_Element.Size = UDim2.new(1, 0, 0, 23)
CheckBox_ElementLayout.Name = "CheckBox_ElementLayout"
CheckBox_ElementLayout.Parent = CheckBox_Element
CheckBox_ElementLayout.FillDirection = Enum.FillDirection.Horizontal
CheckBox_ElementLayout.SortOrder = Enum.SortOrder.LayoutOrder
CheckBox_ElementLayout.Padding = UDim.new(0, 10)
CheckBox_ElementBox.Name = "CheckBox_ElementBox"
CheckBox_ElementBox.Parent = CheckBox_Element
CheckBox_ElementBox.BackgroundColor3 = Color3.fromRGB(36, 65, 106)
CheckBox_ElementBox.BorderColor3 = Color3.fromRGB(74, 74, 83)
CheckBox_ElementBox.Size = UDim2.new(0, 22, 0, 22)
CheckBox_ElementBoxInput.Name = "CheckBox_ElementBoxInput"
CheckBox_ElementBoxInput.Parent = CheckBox_ElementBox
CheckBox_ElementBoxInput.AnchorPoint = Vector2.new(0.5, 0.5)
CheckBox_ElementBoxInput.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
CheckBox_ElementBoxInput.BackgroundTransparency = 1.000
CheckBox_ElementBoxInput.Position = UDim2.new(0.5, 0, 0.5, 0)
CheckBox_ElementBoxInput.Size = UDim2.new(1, 0, 1, 0)
CheckBox_ElementBoxInput.FontFace = GetFont()
CheckBox_ElementBoxInput.Text = ""
CheckBox_ElementBoxInput.TextColor3 = Color3.fromRGB(0, 0, 0)
CheckBox_ElementBoxInput.TextSize = 14.000
CheckBox_ElementImage.Name = "CheckBox_ElementImage"
CheckBox_ElementImage.Parent = CheckBox_ElementBox
CheckBox_ElementImage.AnchorPoint = Vector2.new(0.5, 0.5)
CheckBox_ElementImage.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
CheckBox_ElementImage.BackgroundTransparency = 1.000
CheckBox_ElementImage.Position = UDim2.new(0.5, 0, 0.5, 0)
CheckBox_ElementImage.Size = UDim2.new(0, 14, 0, 16)
CheckBox_ElementImage.Image = "rbxassetid://13058405207"
CheckBox_ElementName.Name = "CheckBox_ElementName"
CheckBox_ElementName.Parent = CheckBox_Element
CheckBox_ElementName.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
CheckBox_ElementName.BackgroundTransparency = 1.000
CheckBox_ElementName.Size = UDim2.new(1, 0, 0, 20)
CheckBox_ElementName.FontFace = GetFont()
CheckBox_ElementName.Text = CheckBoxOptions.Name
CheckBox_ElementName.TextColor3 = Color3.fromRGB(255, 255, 255)
CheckBox_ElementName.TextSize = 17.000
CheckBox_ElementName.TextXAlignment = Enum.TextXAlignment.Left
if Enabled then
CheckBox_ElementImage.Visible = true
pcall(CheckBoxOptions.OnChanged, Enabled)
else
CheckBox_ElementImage.Visible = false
pcall(CheckBoxOptions.OnChanged, Enabled)
end
CheckBox_ElementBoxInput.MouseButton1Click:Connect(function()
Enabled = not Enabled
if Enabled then
CheckBox_ElementImage.Visible = true
else
CheckBox_ElementImage.Visible = false
end
pcall(CheckBoxOptions.OnChanged, Enabled)
end)
end
function ElementHandler:Seperator()
local Seperator_Element = Instance.new("Frame")
Seperator_Element.Name = "Seperator_Element"
Seperator_Element.Parent = WindowElements
Seperator_Element.BackgroundColor3 = Color3.fromRGB(74, 74, 83)
Seperator_Element.BorderColor3 = Color3.fromRGB(27, 42, 53)
Seperator_Element.BorderSizePixel = 0
Seperator_Element.Size = UDim2.new(1, 0, 0, 1)
end
function ElementHandler:ColorPicker3(ColorPickerArgs)
local Color_Element = Instance.new("Frame")
local Color_ElementLayout = Instance.new("UIListLayout")
local Color_ElementRed = Instance.new("Frame")
local Color_ElementRedTextInput = Instance.new("TextBox")
local Color_ElementRedButtonInput = Instance.new("TextButton")
local Color_ElementGreen = Instance.new("Frame")
local Color_ElementGreenTextInput = Instance.new("TextBox")
local Color_ElementGreenButtonInput = Instance.new("TextButton")
local Color_ElementBlue = Instance.new("Frame")
local Color_ElementBlueTextInput = Instance.new("TextBox")
local Color_ElementBlueButtonInput = Instance.new("TextButton")
local Color_ElementDisplay = Instance.new("Frame")
local Color_ElementName = Instance.new("TextLabel")
local ColorPickerName = ColorPickerArgs.Name
Color_Element.Name = "Color_Element"
Color_Element.Parent = WindowElements
Color_Element.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Color_Element.BackgroundTransparency = 1.000
Color_Element.Position = UDim2.new(0, 0, 0.49666667, 0)
Color_Element.Size = UDim2.new(1, 0, 0, 23)
Color_ElementLayout.Name = "Color_ElementLayout"
Color_ElementLayout.Parent = Color_Element
Color_ElementLayout.FillDirection = Enum.FillDirection.Horizontal
Color_ElementLayout.SortOrder = Enum.SortOrder.LayoutOrder
Color_ElementLayout.Padding = UDim.new(0, 7)
Color_ElementRed.Name = "Color_ElementRed"
Color_ElementRed.Parent = Color_Element
Color_ElementRed.BackgroundColor3 = Color3.fromRGB(41, 74, 122)
Color_ElementRed.BorderColor3 = Color3.fromRGB(74, 74, 83)
Color_ElementRed.Size = UDim2.new(0, 60, 1, 0)
Color_ElementRedTextInput.Name = "Color_ElementRedTextInput"
Color_ElementRedTextInput.Parent = Color_ElementRed
Color_ElementRedTextInput.AnchorPoint = Vector2.new(0.5, 0.5)
Color_ElementRedTextInput.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Color_ElementRedTextInput.BackgroundTransparency = 1.000
Color_ElementRedTextInput.Position = UDim2.new(0.5, 0, 0.5, 0)
Color_ElementRedTextInput.Size = UDim2.new(0, 25, 1, 0)
Color_ElementRedTextInput.FontFace = GetFont()
Color_ElementRedTextInput.PlaceholderColor3 = Color3.fromRGB(255, 255, 255)
Color_ElementRedTextInput.PlaceholderText = "R:255"
Color_ElementRedTextInput.Text = "R:255"
Color_ElementRedTextInput.TextColor3 = Color3.fromRGB(255, 255, 255)
Color_ElementRedTextInput.TextSize = 17.000
Color_ElementRedButtonInput.Name = "Color_ElementRedButtonInput"
Color_ElementRedButtonInput.Parent = Color_ElementRed
Color_ElementRedButtonInput.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Color_ElementRedButtonInput.BackgroundTransparency = 1.000
Color_ElementRedButtonInput.Size = UDim2.new(1, 0, 1, 0)
Color_ElementRedButtonInput.FontFace = GetFont()
Color_ElementRedButtonInput.Text = ""
Color_ElementRedButtonInput.TextColor3 = Color3.fromRGB(0, 0, 0)
Color_ElementRedButtonInput.TextSize = 14.000
Color_ElementGreen.Name = "Color_ElementGreen"
Color_ElementGreen.Parent = Color_Element
Color_ElementGreen.BackgroundColor3 = Color3.fromRGB(41, 74, 122)
Color_ElementGreen.BorderColor3 = Color3.fromRGB(74, 74, 83)
Color_ElementGreen.Size = UDim2.new(0, 60, 1, 0)
Color_ElementGreenTextInput.Name = "Color_ElementGreenTextInput"
Color_ElementGreenTextInput.Parent = Color_ElementGreen
Color_ElementGreenTextInput.AnchorPoint = Vector2.new(0.5, 0.5)
Color_ElementGreenTextInput.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Color_ElementGreenTextInput.BackgroundTransparency = 1.000
Color_ElementGreenTextInput.Position = UDim2.new(0.5, 0, 0.5, 0)
Color_ElementGreenTextInput.Size = UDim2.new(0, 25, 1, 0)
Color_ElementGreenTextInput.FontFace = GetFont()
Color_ElementGreenTextInput.PlaceholderColor3 = Color3.fromRGB(255, 255, 255)
Color_ElementGreenTextInput.PlaceholderText = "G:255"
Color_ElementGreenTextInput.Text = "G:255"
Color_ElementGreenTextInput.TextColor3 = Color3.fromRGB(255, 255, 255)
Color_ElementGreenTextInput.TextSize = 17.000
Color_ElementGreenButtonInput.Name = "Color_ElementGreenButtonInput"
Color_ElementGreenButtonInput.Parent = Color_ElementGreen
Color_ElementGreenButtonInput.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Color_ElementGreenButtonInput.BackgroundTransparency = 1.000
Color_ElementGreenButtonInput.Size = UDim2.new(1, 0, 1, 0)
Color_ElementGreenButtonInput.FontFace = GetFont()
Color_ElementGreenButtonInput.Text = ""
Color_ElementGreenButtonInput.TextColor3 = Color3.fromRGB(0, 0, 0)
Color_ElementGreenButtonInput.TextSize = 14.000
Color_ElementBlue.Name = "Color_ElementBlue"
Color_ElementBlue.Parent = Color_Element
Color_ElementBlue.BackgroundColor3 = Color3.fromRGB(41, 74, 122)
Color_ElementBlue.BorderColor3 = Color3.fromRGB(74, 74, 83)
Color_ElementBlue.Size = UDim2.new(0, 60, 1, 0)
Color_ElementBlueTextInput.Name = "Color_ElementBlueTextInput"
Color_ElementBlueTextInput.Parent = Color_ElementBlue
Color_ElementBlueTextInput.AnchorPoint = Vector2.new(0.5, 0.5)
Color_ElementBlueTextInput.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Color_ElementBlueTextInput.BackgroundTransparency = 1.000
Color_ElementBlueTextInput.Position = UDim2.new(0.5, 0, 0.5, 0)
Color_ElementBlueTextInput.Size = UDim2.new(0, 25, 1, 0)
Color_ElementBlueTextInput.FontFace = GetFont()
Color_ElementBlueTextInput.PlaceholderColor3 = Color3.fromRGB(255, 255, 255)
Color_ElementBlueTextInput.PlaceholderText = "B:255"
Color_ElementBlueTextInput.Text = "B:255"
Color_ElementBlueTextInput.TextColor3 = Color3.fromRGB(255, 255, 255)
Color_ElementBlueTextInput.TextSize = 17.000
Color_ElementBlueButtonInput.Name = "Color_ElementBlueButtonInput"
Color_ElementBlueButtonInput.Parent = Color_ElementBlue
Color_ElementBlueButtonInput.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Color_ElementBlueButtonInput.BackgroundTransparency = 1.000
Color_ElementBlueButtonInput.Size = UDim2.new(1, 0, 1, 0)
Color_ElementBlueButtonInput.FontFace = GetFont()
Color_ElementBlueButtonInput.Text = ""
Color_ElementBlueButtonInput.TextColor3 = Color3.fromRGB(0, 0, 0)
Color_ElementBlueButtonInput.TextSize = 14.000
Color_ElementDisplay.Name = "Color_ElementDisplay"
Color_ElementDisplay.Parent = Color_Element
Color_ElementDisplay.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Color_ElementDisplay.BorderColor3 = Color3.fromRGB(74, 74, 83)
Color_ElementDisplay.Size = UDim2.new(0, 23, 0, 23)
Color_ElementName.Name = "Color_ElementName"
Color_ElementName.Parent = Color_Element
Color_ElementName.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Color_ElementName.BackgroundTransparency = 1.000
Color_ElementName.Position = UDim2.new(2.21000075, 0, 0, 0)
Color_ElementName.Size = UDim2.new(1, 0, 0, 23)
Color_ElementName.FontFace = GetFont()
Color_ElementName.Text = ColorPickerName
Color_ElementName.TextColor3 = Color3.fromRGB(255, 255, 255)
Color_ElementName.TextSize = 17.000
Color_ElementName.TextXAlignment = Enum.TextXAlignment.Left
local UIS = game:GetService("UserInputService")
local CurrentColor = ColorPickerArgs.DefaultColor or Color3.fromRGB(255, 255, 255)
local R, G, B = CurrentColor.R, CurrentColor.G, CurrentColor.B;
local function setColor()
Color_ElementDisplay.BackgroundColor3 = CurrentColor
pcall(ColorPickerArgs.OnChanged, CurrentColor)
end
local function updateColor()
CurrentColor = Color3.fromRGB(R, G, B)
setColor()
end
setColor()
Color_ElementRedTextInput.Text = string.format("R:%.0f", Color_ElementDisplay.BackgroundColor3.R);
Color_ElementGreenTextInput.Text = string.format("G:%.0f", Color_ElementDisplay.BackgroundColor3.G);
Color_ElementBlueTextInput.Text = string.format("B:%.0f", Color_ElementDisplay.BackgroundColor3.B);
for _, colorButton in pairs(Color_Element:GetDescendants()) do
if colorButton:IsA("TextButton") then
colorButton.MouseButton1Down:Connect(function()
while UIS:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
local x = math.clamp(UIS:GetMouseLocation().X - colorButton.AbsolutePosition.X, 0, colorButton.AbsoluteSize.X)
local value = math.floor(x / colorButton.AbsoluteSize.X * 255 + 0.5)
local color = string.sub(colorButton.Name, 14, 14)
if color == "R" then
R = value
Color_ElementRedTextInput.Text = string.format("R:%s", value);
updateColor()
elseif color == "G" then
G = value
Color_ElementGreenTextInput.Text = string.format("G:%s", value);
updateColor()
elseif color == "B" then
B = value
Color_ElementBlueTextInput.Text = string.format("B:%s", value);
updateColor()
end
task.wait()
end
end)
end
end
end
function ElementHandler:RadioButtons(RadioButtonsArgs)
local Radio_Element = Instance.new("Frame")
local Radio_ElementLayout = Instance.new("UIListLayout")
Radio_Element.Name = "Radio_Element"
Radio_Element.Parent = WindowElements
Radio_Element.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Radio_Element.BackgroundTransparency = 1.000
Radio_Element.Position = UDim2.new(0, 0, 0.49666667, 0)
Radio_Element.Size = UDim2.new(1, 0, 0, 23)
Radio_ElementLayout.Name = "Radio_ElementLayout"
Radio_ElementLayout.Parent = Radio_Element
Radio_ElementLayout.FillDirection = Enum.FillDirection.Horizontal
Radio_ElementLayout.SortOrder = Enum.SortOrder.LayoutOrder
Radio_ElementLayout.Padding = UDim.new(0, 7)
local Default = RadioButtonsArgs.Default
local RadioButtons = {}
for i, radio in pairs(RadioButtonsArgs.Buttons) do
local Radio_ElementItem = Instance.new("Frame")
local Radio_ElementItemLayout = Instance.new("UIListLayout")
local Radio_ElementItemButton = Instance.new("Frame")
local Radio_ElementItemButtonCorner = Instance.new("UICorner")
local Radio_ElementItemButtonState = Instance.new("Frame")
local Radio_ElementItemButtonStateCorner = Instance.new("UICorner")
local Radio_ElementItemButtonInput = Instance.new("TextButton")
local Radio_ElementItemName = Instance.new("TextLabel")
local RadioEnabled = false
Radio_Element.Name = "Radio_Element"
Radio_Element.Parent = WindowElements
Radio_Element.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Radio_Element.BackgroundTransparency = 1.000
Radio_Element.Position = UDim2.new(0, 0, 0.49666667, 0)
Radio_Element.Size = UDim2.new(1, 0, 0, 23)
Radio_ElementItemName.Name = "Radio_ElementItemName"
Radio_ElementItemName.Parent = Radio_ElementItem
Radio_ElementItemName.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Radio_ElementItemName.BackgroundTransparency = 1.000
Radio_ElementItemName.Position = UDim2.new(0.240384609, 0, 0, 0)
Radio_ElementItemName.Size = UDim2.new(0.644999981, 0, 1, 0)
Radio_ElementItemName.FontFace = GetFont()
Radio_ElementItemName.Text = radio
Radio_ElementItemName.TextColor3 = Color3.fromRGB(255, 255, 255)
Radio_ElementItemName.TextSize = 17.000
Radio_ElementItemName.TextXAlignment = Enum.TextXAlignment.Left
Radio_ElementLayout.Name = "Radio_ElementLayout"
Radio_ElementLayout.Parent = Radio_Element
Radio_ElementLayout.FillDirection = Enum.FillDirection.Horizontal
Radio_ElementLayout.SortOrder = Enum.SortOrder.LayoutOrder
Radio_ElementLayout.Padding = UDim.new(0, 7)
Radio_ElementItem.Name = "Radio_ElementItem"
Radio_ElementItem.Parent = Radio_Element
Radio_ElementItem.BackgroundColor3 = Color3.fromRGB(41, 74, 122)
Radio_ElementItem.BackgroundTransparency = 1.000
Radio_ElementItem.Size = UDim2.new(0, 23 + (Radio_ElementItemName.TextBounds.X) + 7, 1, 0)
Radio_ElementItemLayout.Name = "Radio_ElementItemLayout"
Radio_ElementItemLayout.Parent = Radio_ElementItem
Radio_ElementItemLayout.FillDirection = Enum.FillDirection.Horizontal
Radio_ElementItemLayout.SortOrder = Enum.SortOrder.LayoutOrder
Radio_ElementItemLayout.VerticalAlignment = Enum.VerticalAlignment.Center
Radio_ElementItemLayout.Padding = UDim.new(0, 7)
Radio_ElementItemButton.Name = "Radio_ElementItemButton"
Radio_ElementItemButton.Parent = Radio_ElementItem
Radio_ElementItemButton.BackgroundColor3 = Color3.fromRGB(41, 74, 122)
Radio_ElementItemButton.Size = UDim2.new(0, 18, 0, 18)
Radio_ElementItemButtonCorner.CornerRadius = UDim.new(1, 0)
Radio_ElementItemButtonCorner.Name = "Radio_ElementItemButtonCorner"
Radio_ElementItemButtonCorner.Parent = Radio_ElementItemButton
Radio_ElementItemButtonState.Name = "Radio_ElementItemButtonState"
Radio_ElementItemButtonState.Parent = Radio_ElementItemButton
Radio_ElementItemButtonState.AnchorPoint = Vector2.new(0.5, 0.5)
Radio_ElementItemButtonState.BackgroundColor3 = Color3.fromRGB(66, 120, 196)
Radio_ElementItemButtonState.Position = UDim2.new(0.5, 0, 0.5, 0)
Radio_ElementItemButtonState.Size = UDim2.new(0, 14, 0, 14)
Radio_ElementItemButtonStateCorner.CornerRadius = UDim.new(1, 0)
Radio_ElementItemButtonStateCorner.Name = "Radio_ElementItemButtonStateCorner"
Radio_ElementItemButtonStateCorner.Parent = Radio_ElementItemButtonState
Radio_ElementItemButtonInput.Name = "Radio_ElementItemButtonInput"
Radio_ElementItemButtonInput.Parent = Radio_ElementItemButton
Radio_ElementItemButtonInput.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Radio_ElementItemButtonInput.BackgroundTransparency = 1.000
Radio_ElementItemButtonInput.Size = UDim2.new(1, 0, 1, 0)
Radio_ElementItemButtonInput.FontFace = GetFont()
Radio_ElementItemButtonInput.Text = ""
Radio_ElementItemButtonInput.TextColor3 = Color3.fromRGB(0, 0, 0)
Radio_ElementItemButtonInput.TextSize = 14.000
if radio == Default then
RadioEnabled = true
Radio_ElementItemButtonState.Visible = true;
else
RadioEnabled = false
Radio_ElementItemButtonState.Visible = false;
end
local radioButton = {
Name = radio,
Enabled = RadioEnabled,
Update = nil
}
radioButton.Update = function()
if radioButton.Enabled then
Radio_ElementItemButtonState.Visible = true;
else
Radio_ElementItemButtonState.Visible = false;
end
end
Radio_ElementItemButtonInput.MouseButton1Click:Connect(function()
if not radioButton.Enabled then -- only do something if the button is not already selected
radioButton.Enabled = true
radioButton.Update()
pcall(RadioButtonsArgs.OnChanged, radioButton.Name, radioButton.Enabled)
for _, rad in pairs(RadioButtons) do
if rad ~= radioButton then -- deselect other buttons