-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathv2.0.lua
1976 lines (1799 loc) · 62.7 KB
/
v2.0.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
-- PotatoMod v2.2 created by NicePotato (.nicepotato)
-- Credits to Cristiano and Ayray for letting this project exist
-- Credits to ayray for helping during development
-- Mind my spaghetti (much less than v1 though lol)
-- TODO remake dropdown arrow for theme (toolbox)
-- TODO hook tabs
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local GetSettings = ReplicatedStorage.RemoteFunctions.GetPotatoModSettings
local SetSettings = ReplicatedStorage.RemoteEvents.SetPotatoModSettings
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer.PlayerGui
local StudioGui = PlayerGui:WaitForChild("StudioGui",5) -- The GUI of the studio
local Windows = StudioGui:WaitForChild("Windows",5) -- The main windows of the studio
local Topbar = StudioGui:WaitForChild("Topbar",5)
local MenusBar = Topbar:WaitForChild("MenusBar",5)
local themes = {
dark = {
header = Color3.fromRGB(64,64,64),
bg = Color3.fromRGB(46,46,46),
ol = Color3.fromRGB(60,60,60),
font = Enum.Font.SourceSans,
font_bold = Enum.Font.SourceSansBold,
text = Color3.fromRGB(240,240,240),
text_print = Color3.fromRGB(240,240,240),
text_info = Color3.fromRGB(0,155,255),
text_error = Color3.fromRGB(255,0,0),
text_warn = Color3.fromRGB(255, 128, 0),
zebra_1 = Color3.fromRGB(46,46,46),
zebra_2 = Color3.fromRGB(50, 50, 50),
scrollback = Color3.fromRGB(40,40,40),
scrollbar = Color3.fromRGB(64,64,64)
},
classic = {
header = Color3.fromRGB(80,80,80),
bg = Color3.fromRGB(40,40,40),
ol = Color3.fromRGB(100,100,100),
font = Enum.Font.SourceSans,
font_bold = Enum.Font.SourceSansBold,
text = Color3.fromRGB(240,240,240),
text_print = Color3.fromRGB(240,240,240),
text_info = Color3.fromRGB(0,155,255),
text_error = Color3.fromRGB(255,0,0),
text_warn = Color3.fromRGB(255, 128, 0),
zebra_1 = Color3.fromRGB(40,40,40),
zebra_2 = Color3.fromRGB(44,44,44),
scrollback = Color3.fromRGB(40,40,40),
scrollbar = Color3.fromRGB(80,80,80)
}
}
local theme = {
header = "header",
bg = "bg",
ol = "ol",
font = "font",
font_bold = "font_bold",
text = "text",
text_print = "text_print",
text_info = "text_info",
text_error = "text_error",
text_warn = "text_warn",
zebra_1 = "zebra_1",
zebra_2 = "zebra_2",
scrollback = "scrollback",
scrollbar = "scrollbar"
}
-- PotatoInjector has no script property
local maindebug = false
if not script then
warn("PotatoInjector has injected PotatoMod2!!! wow!!!")
maindebug = true
elseif _is_exploit_env then
warn("PotatoInjector loaded by executor, debug mode enabled!!!")
maindebug = true
end
local instanceList = {}
local guiLayoutUnknown = false -- Has the gui been changed/updated?
local function handleError(errorString)
error("\nPotatoMod2 has crashed (oh no)!\nError: "..errorString.."\nPlease report this to NicePotato (.nicepotato)")
print("Challenge Complete: How did we get here?") -- this should not run
end
local function splitString(inputString, delimiter)
local result = {}
local pattern = string.format("([^%s]+)", delimiter)
inputString:gsub(pattern, function(substring)
table.insert(result, substring)
end)
return result
end
local function getNested(obj, children, debug)
debug = debug or false
children = splitString(children,".")
for _, v in pairs(children) do
if not obj:IsA("Instance") or not obj:FindFirstChild(v) then
if not debug then
guiLayoutUnknown = true
end
return nil
end
obj = obj[v]
end
return obj
end
-- Handle Settings
local function serialize(data)
if typeof(data) == "Color3" then
return {
SerializedType = "Color3",
r = data.r,
g = data.g,
b = data.b
}
end
if typeof(data) == "EnumItem" then
return data.Value
end
return data -- Data does not need to be serialized
end
local function deserialize(data)
if type(data) == "table" then
local dataType = data["SerializedType"]
if dataType then -- Is this data serialized?
if dataType == "Color3" then
return Color3.new(data.r,data.g,data.b)
end
else
return data -- Table is not serialized data
end
else
return data -- Data is not serialized data
end
end
local function serializeTable(inTable,recurse)
recurse = recurse or 0
if recurse >= 1000 then
warn("Warning: Table serializer overflow! Data may be corrupted.")
return
end
local outTable = {}
for k,v in pairs(inTable) do
k = serialize(k)
v = serialize(v)
if type(k) == "table" then
k = serializeTable(k,recurse+1)
end
if type(v) == "table" then
v = serializeTable(v,recurse+1)
end
outTable[k] = v
end
return outTable
end
local function deserializeTable(inTable,recurse)
recurse = recurse or 0
if recurse >= 1000 then
warn("Warning: Table deserializer overflow! Data may be corrupted.")
return
end
local outTable = {}
for k,v in pairs(inTable) do
k = deserialize(k) -- Key may be serialized data
v = deserialize(v) -- Value may be serialized data
if type(k) == "table" then
k = deserializeTable(k,recurse+1)
end
if type(v) == "table" then
v = deserializeTable(v,recurse+1)
end
outTable[k] = v
end
return outTable
end
local Settings = deserializeTable(GetSettings:InvokeServer())
local function printTable(table,depth, key)
depth = depth or 1
local function textBrackets()
if typeof(table) == "Instance" then
if #table:GetChildren() == 0 then
return "{}"
else
return "{"
end
else
if #table == 0 then
return "{}"
else
return "{"
end
end
end
if typeof(table) == "Instance" then
if key then
print(string.rep(" ",depth-1).."["..tostring(key).."] = <["..table.ClassName..":"..table.Name.."]> = "..textBrackets())
else
print(string.rep(" ",depth-1).."<["..table.ClassName..":"..table.Name.."]> = "..textBrackets())
end
table = table:GetChildren()
else
if key then
print(string.rep(" ",depth-1).."["..tostring(key).."] = "..textBrackets())
else
print(string.rep(" ",depth-1)..textBrackets())
end
end
for k,v in pairs(table) do
if type(v) == "table" or typeof(v) == "Instance" then
printTable(v,depth+1,k)
else
print(string.rep(" ",depth).."["..tostring(k).."] = "..tostring(v))
end
end
if #table > 0 then
print(string.rep(" ",depth-1).."}")
end
end
local settingsVersion = 4
local defaultSettings = {
version = settingsVersion,
toggles = {
autoLaunch = false,
enableTheme = true
},
themedata = {
current = "dark",
customTheme = {}
},
used_before = false
}
for k,v in pairs(themes.dark) do
defaultSettings.themedata.customTheme[k] = v
end
if not Settings["version"] or Settings["version"] < settingsVersion then
Settings = defaultSettings
end
themes["current"] = themes[Settings.themedata.current]
local last_save = 0
local function SaveSettings(force)
force = force or false
if os.clock() - last_save >= 1 or force then
last_save = os.clock()
SetSettings:FireServer(serializeTable(Settings))
end
end
--[[ docs probably outdated lol
1 - instance
2 - theme
1 - default
2 - potato
[property]
{initial, replace}
3 - dynamic
[entry]
1 - connect function
2 - disconnect function
3 - arg table
4 - connections
4 - property
1 - default
2 - potato
[property]
{initial, replace}
5 - delete?
Register new object
]]
local currentInst -- Instance to apply property to
local PotatoTab
local function registerStudio()
-- I made these lowercase to type them easier
local function newreg(instance, child, debug) -- Register a new instance to be modified
if type(instance) == "table" then instance = instance[1] end
if instance and getNested(instance,child,debug) then
local new = {getNested(instance,child,debug),{},{},{}} -- {instance, themeProperties, dynamics, properties}
instanceList[#instanceList+1] = new
currentInst = new
return new
else
if not debug then
warn("PotatoMod2: "..instance:GetFullName().."."..child.. " is missing!")
guiLayoutUnknown = true
currentInst = nil
return nil
end
end
end
local function newself(instance,debug)
debug = debug or false
if instance then
local new = {instance,{},{},{}} -- {instance, themeProperties, dynamics, properties}
instanceList[#instanceList+1] = new
currentInst = new
return new
else
if not debug then
warn("PotatoMod2: "..instance:GetFullName().. " is missing!")
guiLayoutUnknown = true
currentInst = nil
return nil
end
end
end
local function regtheme(property, value, instance, debug) -- Register a static property theme change
-- This takes keys for the theme table
instance = instance or currentInst
debug = debug or false
local set, message = pcall(function()
if instance then
instance[2][property] = {instance[1][property],value} -- {initial,replace}
else
if not debug then
guiLayoutUnknown = true
return nil
end
end
end)
if not set then
if not debug then
warn("PotatoMod2: "..message)
guiLayoutUnknown = true
return nil
end
end
end
local function regprop(property, value, instance, debug) -- Register a static property change
-- This is the exact same as theme change, but it gets rendered in another step
-- This takes any arbitrary value
instance = instance or currentInst
debug = debug or false
local set, message = pcall(function()
if instance then
instance[4][property] = {instance[1][property],value} -- {initial,replace}
else
if not debug then
guiLayoutUnknown = true
return nil
end
end
end)
if not set then
if not debug then
warn("PotatoMod2: "..message)
guiLayoutUnknown = true
return nil
end
end
end
local function regdynamic(connectFunc, disconnectFunc, argtable, instance, debug) -- Register a dynamic change
instance = instance or currentInst
debug = debug or false
argtable = argtable or {}
if instance then
instance[3][#instance[3]+1] = {connectFunc,disconnectFunc,argtable} -- {connectFunc,disconnectFunc,args}
else
if not debug then
guiLayoutUnknown = true
return nil
end
end
end
local function marktemp(instance, debug) -- Mark to be deleted
instance = instance or currentInst
debug = debug or false
instance[5] = true
end
local function dynamicReplaceThemeConnect(instance,entry) -- replace all theme property [keys] with [value]
-- argtable
-- [property]
-- [original]
-- = replace
entry[4] = {} -- Connections
for property,values in pairs(entry[3]) do -- for all properties in argtable
for init,replace in pairs(values) do
if instance[property] == init then
instance[property] = themes.current[replace]
end
local connection = instance:GetPropertyChangedSignal(property):Connect(function()
-- Really hope they don't start fighting over each other for their wanted value! (please don't)
if instance[property] == init then
instance[property] = themes.current[replace]
end
end)
entry[4][#entry[4]+1] = connection
end
end
end
local function dynamicReplaceThemeDisconnect(instance,entry) -- kill active replaces and reset to inital value
if not entry[4] then return end -- If not connected, can't disconnect
for _,connection in pairs(entry[4]) do -- for all connections
connection:Disconnect()
end
for property,values in pairs(entry[3]) do -- for all properties in argtable
for init,replace in pairs(values) do
if instance[property] == themes.current[replace] then -- if value has been replaced, restore it
instance[property] = init
end
end
end
end
local function dynamicReplacePropertyConnect(instance,entry) -- replace all property [keys] with [value]
-- argtable
-- [property]
-- [original]
-- = replace
entry[4] = {} -- Connections
for property,values in pairs(entry[3]) do -- for all properties in argtable
for init,replace in pairs(values) do
if instance[property] == init then
instance[property] = replace
end
local connection = instance:GetPropertyChangedSignal(property):Connect(function()
-- Really hope they don't start fighting over each other for their wanted value! (please don't)
if instance[property] == init then
instance[property] = replace
end
end)
entry[4][#entry[4]+1] = connection
end
end
end
local function dynamicReplacePropertyDisconnect(instance,entry) -- kill active replaces and reset to inital value
if not entry[4] then return end -- If not connected, can't disconnect
for _,connection in pairs(entry[4]) do -- for all connections
connection:Disconnect()
end
for property,values in pairs(entry[3]) do -- for all properties in argtable
for init,replace in pairs(values) do
if instance[property] == replace then -- if value has been replaced, restore it
instance[property] = init
end
end
end
end
-- ... used to allow setting static inside of function
local function regfont(...) -- Register a default text change
regtheme("TextColor3",theme.text)
regtheme("Font",theme.font)
end
local function regdefault(...) -- Register a default instance property change
regtheme("BackgroundColor3",theme.bg)
regtheme("BorderColor3",theme.ol)
if currentInst[1]:IsA("TextLabel") or currentInst[1]:IsA("TextBox") or currentInst[1]:IsA("TextButton") then
regfont()
end
end
local function newdefaultself(instance, debug)
local newStatic = newself(instance, debug)
if newStatic then
regdefault()
end
return newStatic
end
local function newdefault(instance, child, debug) -- Register a new instance with default properties
local newStatic = newreg(instance, child, debug)
if newStatic then
regdefault() -- Register default theme properties
end
return newStatic
end
local function regheader(...)
-- default x unhovered rbxassetid://13622951236
-- default x hovered rbxassetid://13622964770
-- mod x unhovered rbxassetid://16336560641
-- mod x hovered rbxassetid://16336555516
regtheme("BackgroundColor3",theme.header)
regtheme("BorderColor3",theme.ol)
regfont()
local CloseButton = newreg(currentInst,"CloseButton")
if CloseButton then
regtheme("ImageColor3",theme.text)
regdynamic(dynamicReplacePropertyConnect,
dynamicReplacePropertyDisconnect,
{
["Image"] = {
["rbxassetid://13622951236"] = "rbxassetid://16336560641", -- x unhovered
["rbxassetid://13622964770"] = "rbxassetid://16336555516" -- x hovered
}
})
end
end
local function newheader(instance, child, debug) -- Register a new header
local newHeader = newself(instance[1]:WaitForChild(child, 5))
if newHeader then
regheader()
else
warn("PotatoMod2: Headers are misplaced, buggy behaviour will ensue")
end
return newHeader
end
local function regscrollbar(...)
-- mod scroll arrow - rbxassetid://16434877920
local function hideSomeStuff(Bar)
local SemiHover = newreg(Bar,"SemiHover")
if SemiHover then
regprop("Image","")
regprop("BackgroundTransparency",1)
end
local Hover = newreg(Bar,"Hover")
if Hover then
regprop("Image","")
regprop("BackgroundTransparency",1)
end
local Down = newreg(Bar,"Down")
if Down then
regprop("Image","")
regprop("BackgroundTransparency",1)
end
end
local Scrollbar = currentInst
regtheme("BackgroundColor3",theme.scrollback)
regtheme("BorderColor3",theme.ol)
local Vertical = newreg(Scrollbar,"Vertical")
if Vertical then
local DownButton = newreg(Vertical,"DownButton")
if DownButton then
hideSomeStuff(DownButton)
local NewArrow = newself(Instance.new("ImageLabel"))
if NewArrow then
marktemp()
regtheme("BackgroundColor3",theme.scrollbar)
regtheme("BorderColor3",theme.scrollbar)
NewArrow[1].Parent = DownButton[1]
NewArrow[1].ZIndex = 5
NewArrow[1].Size = DownButton[1].Size
NewArrow[1].Active = false
NewArrow[1].Rotation = 0
NewArrow[1].Image = "rbxassetid://16434877920"
NewArrow[1].Visible = false
end
end
local UpButton = newreg(Vertical,"UpButton")
if UpButton then
hideSomeStuff(UpButton)
local NewArrow = newself(Instance.new("ImageLabel"))
if NewArrow then
marktemp()
regtheme("BackgroundColor3",theme.scrollbar)
regtheme("BorderColor3",theme.scrollbar)
NewArrow[1].Parent = UpButton[1]
NewArrow[1].ZIndex = 5
NewArrow[1].Size = UpButton[1].Size
NewArrow[1].Active = false
NewArrow[1].Rotation = 180
NewArrow[1].Image = "rbxassetid://16434877920"
NewArrow[1].Visible = false
end
end
local BarExtents = newreg(Vertical,"BarExtents")
if BarExtents then
regprop("ImageTransparency",1)
local Bar = newreg(BarExtents,"Bar")
if Bar then -- I'd prefer not to replace the image, however it's most efficient here
regprop("Image","")
regprop("BackgroundTransparency",0)
regprop("AutoButtonColor",true)
regtheme("BackgroundColor3",theme.scrollbar)
regtheme("BorderColor3",theme.ol)
hideSomeStuff(Bar)
local Thing = newreg(Bar,"Thing")
if Thing then
regprop("Image","")
regprop("BackgroundTransparency",1)
hideSomeStuff(Thing)
end
end
end
local LeftBorder = newreg(Vertical,"LeftBorder")
if LeftBorder then
regtheme("BackgroundColor3",theme.ol)
end
local RightBorder = newreg(Vertical,"RightBorder")
if RightBorder then
regtheme("BackgroundColor3",theme.ol)
end
end
local Horizontal = newreg(Scrollbar,"Horizontal")
if Horizontal then
local LeftButton = newreg(Horizontal,"LeftButton")
if LeftButton then
hideSomeStuff(LeftButton)
local NewArrow = newself(Instance.new("ImageLabel"))
if NewArrow then
marktemp()
regtheme("BackgroundColor3",theme.scrollbar)
regtheme("BorderColor3",theme.scrollbar)
NewArrow[1].Parent = LeftButton[1]
NewArrow[1].ZIndex = 5
NewArrow[1].Size = LeftButton[1].Size
NewArrow[1].Active = false
NewArrow[1].Rotation = 90
NewArrow[1].Image = "rbxassetid://16434877920"
NewArrow[1].Visible = false
end
end
local RightButton = newreg(Horizontal,"RightButton")
if RightButton then
hideSomeStuff(RightButton)
local NewArrow = newself(Instance.new("ImageLabel"))
if NewArrow then
marktemp()
regtheme("BackgroundColor3",theme.scrollbar)
regtheme("BorderColor3",theme.scrollbar)
NewArrow[1].Parent = RightButton[1]
NewArrow[1].ZIndex = 5
NewArrow[1].Size = RightButton[1].Size
NewArrow[1].Active = false
NewArrow[1].Rotation = -90
NewArrow[1].Image = "rbxassetid://16434877920"
NewArrow[1].Visible = false
end
end
local BarExtents = newreg(Horizontal,"BarExtents")
if BarExtents then
regprop("ImageTransparency",1)
local Bar = newreg(BarExtents,"Bar")
if Bar then -- I'd prefer not to replace the image, however it's most efficient here
regprop("Image","")
regprop("BackgroundTransparency",0)
regprop("AutoButtonColor",true)
regtheme("BackgroundColor3",theme.scrollbar)
regtheme("BorderColor3",theme.ol)
hideSomeStuff(Bar)
local Thing = newreg(Bar,"Thing")
if Thing then
regprop("Image","")
regprop("BackgroundTransparency",1)
hideSomeStuff(Thing)
end
end
end
local LowerBorder = newreg(Horizontal,"LowerBorder")
if LowerBorder then
regtheme("BackgroundColor3",theme.ol)
end
local UpperBorder = newreg(Horizontal,"UpperBorder")
if UpperBorder then
regtheme("BackgroundColor3",theme.ol)
end
end
end
local function newscrollbar(instance, child, debug) -- Register a new scrolbar
local newScrollbar = newreg(instance, child, debug)
if newScrollbar then
regscrollbar()
end
return newScrollbar
end
-- PotatoMod Gui
PotatoTab = MenusBar:FindFirstChild("WindowButton")
if PotatoTab then
PotatoTab.Size = UDim2.new(0,69,1,0)
local TextLabel = PotatoTab.TextLabel
TextLabel.Text = "PotatoMod"
PotatoTab.MenuFrame.Visible = false
PotatoTab.MenuFrame.Background.Visible = true
local PotatoFrame = Instance.new("Frame")
PotatoFrame.Size = UDim2.new(1,0,1,0)
PotatoFrame.BackgroundColor3 = themes.dark.bg
PotatoFrame.BorderColor3 = themes.dark.ol
PotatoFrame.Name = "PotatoFrame"
PotatoFrame.Parent = PotatoTab.MenuFrame.Background
local LazyTipLol = Instance.new("TextLabel")
LazyTipLol.Text = [[proper gui coming soon to a PotatoMod2 near you
(I am too lazy rn sorry, be happy with a new version)
credits to NicePotato (me), Ayray, and Cristiano]]
LazyTipLol.Parent = PotatoFrame
LazyTipLol.TextColor3 = themes.dark.text
LazyTipLol.TextSize = 16
LazyTipLol.Font = themes.dark.font
LazyTipLol.BackgroundTransparency = 1
LazyTipLol.Size = UDim2.new(0,300,0,50)
LazyTipLol.Position = UDim2.new(0,5,0,0)
LazyTipLol.TextXAlignment = "Left"
local AutoInjectText = Instance.new("TextLabel")
AutoInjectText.Text = "Auto Launch"
AutoInjectText.Parent = PotatoFrame
AutoInjectText.TextColor3 = themes.dark.text
AutoInjectText.TextSize = 16
AutoInjectText.Font = themes.dark.font
AutoInjectText.BackgroundTransparency = 1
AutoInjectText.Size = UDim2.new(0,80,0,20)
AutoInjectText.Position = UDim2.new(0,5,0,55)
AutoInjectText.TextXAlignment = "Left"
local function renderButtonState(button, state)
if state then
button.Position = UDim2.new(0,22,0,2)
button.BackgroundColor3 = Color3.fromRGB(25,235,25)
button.BorderColor3 = Color3.fromRGB(25,235,25)
else
button.Position = UDim2.new(0,2,0,2)
button.BackgroundColor3 = Color3.fromRGB(255,25,25)
button.BorderColor3 = Color3.fromRGB(235,25,25)
end
end
local AutoInjectButton = Instance.new("TextButton")
AutoInjectButton.Text = ""
AutoInjectButton.BackgroundColor3 = themes.dark.bg
AutoInjectButton.BorderColor3 = themes.dark.ol
AutoInjectButton.Size = UDim2.new(0,40,0,20)
AutoInjectButton.Position = UDim2.new(0,85,0,0)
AutoInjectButton.Parent = AutoInjectText
local AutoInjectSwitch = Instance.new("Frame")
AutoInjectSwitch.Size = UDim2.new(0,16,0,16)
AutoInjectSwitch.BorderMode = Enum.BorderMode.Inset
AutoInjectSwitch.BorderSizePixel = 2
AutoInjectSwitch.Active = false
AutoInjectSwitch.Parent = AutoInjectButton
renderButtonState(AutoInjectSwitch, Settings.toggles["autoLaunch"])
AutoInjectButton.MouseButton1Click:Connect(function()
Settings.toggles["autoLaunch"] = not Settings.toggles["autoLaunch"]
renderButtonState(AutoInjectSwitch, Settings.toggles["autoLaunch"])
SaveSettings()
end)
else
handleError("Funny thing, the tab that PotatoMod embeds itself into has been removed by the devs! (this is not good)")
end
-- CodeEditorLocal
-- TitleBar
-- Toolbox
local Toolbox = newdefault(Windows,"Toolbox")
if Toolbox then
newheader(Toolbox,"WindowHeader")
local EmbedOutline = newdefault(Toolbox,"EmbedOutline")
if EmbedOutline then
local ListFrame = newreg(EmbedOutline,"ListFrame")
if ListFrame then
local List = newdefault(ListFrame,"List")
if List then
regprop("BackgroundTransparency",0)
for _,child in pairs(List[1]:GetChildren()) do
if child:isA("Frame") then
local Model = newdefaultself(child)
if Model then
newdefault(Model,"TextLabel")
newdefault(Model,"ImageLabel")
end
end
end
end
newscrollbar(ListFrame,"ScrollbarBackground")
end
local Controls = newdefault(EmbedOutline,"Controls")
if Controls then
local InventoryControls = newdefault(Controls,"InventoryControls")
if InventoryControls then
local Border = newreg(InventoryControls,"Border")
if Border then
regtheme("BackgroundColor3",theme.ol)
regtheme("BorderColor3",theme.ol)
end
local SortLabel = newdefault(InventoryControls,"SortLabel")
if SortLabel then
local DropdownButton = newdefault(SortLabel,"DropdownButton")
if DropdownButton then
-- TODO remake dropdown arrow for theme
end
local DropdownList = newdefault(SortLabel,"DropdownList")
if DropdownList then
for _,child in pairs(DropdownList[1]:GetChildren()) do
if child:isA("TextButton") then
newdefaultself(child)
end
end
end
end
end
local SearchControls = newreg(Controls,"SearchControls")
if SearchControls then
local SearchBackground = newreg(SearchControls,"SearchBackground")
if SearchBackground then
regprop("BackgroundTransparency",1)
end
newdefault(SearchControls,"SearchBar")
local Border = newreg(InventoryControls,"Border")
if Border then
regtheme("BackgroundColor3",theme.ol)
regtheme("BorderColor3",theme.ol)
end
local DisplayLabel = newreg(SearchControls,"DisplayLabel")
if DisplayLabel then
local DropdownButton = newdefault(DisplayLabel,"DropdownButton")
if DropdownButton then
-- TODO remake dropdown arrow for theme
end
local DropdownList = newdefault(DisplayLabel,"DropdownList")
if DropdownList then
for _,child in pairs(DropdownList[1]:GetChildren()) do
if child:isA("TextButton") then
newdefaultself(child)
end
end
end
end
end
local Tabs = newreg(Controls,"Tabs")
if Tabs then
regtheme("BackgroundColor3",theme.header)
regtheme("BorderColor3",theme.ol)
local replaceColors = {
["BackgroundColor3"] = {
[Color3.fromRGB(240,240,240)] = theme.bg,
[Color3.fromRGB(201,201,201)] = theme.header
}
}
local Inventory = newreg(Tabs,"Inventory")
if Inventory then
regtheme("BorderColor3",theme.ol)
regfont()
regdynamic(dynamicReplaceThemeConnect,
dynamicReplaceThemeDisconnect,
replaceColors)
end
local Search = newreg(Tabs,"Search")
if Search then
regtheme("BorderColor3",theme.ol)
regfont()
regdynamic(dynamicReplaceThemeConnect,
dynamicReplaceThemeDisconnect,
replaceColors)
end
end
end
end
end
-- BasicObjects
local function dynamicBasicObjectsHandlerConnect(instance, entry)
entry[5] = {} -- ObjectName
entry[6] = {} -- Instance Entries
local function recolorTextLabel(TextLabel)
if TextLabel.Parent.MouseOverHighlight.Visible then -- Hovered
TextLabel.TextColor3 = Color3.new(0,0,0)
elseif TextLabel.Parent.SelectionHighlight.Visible then -- Selected
TextLabel.TextColor3 = Color3.new(1,1,1)
else
TextLabel.TextColor3 = themes.current["text"]
end
end
local function hookTextLabel(TextLabel)
if TextLabel:IsA("TextLabel") then
TextLabel.Font = themes.current["font"]
TextLabel.Parent.NoteLabel.Font = themes.current["font"]
TextLabel.Parent.NoteLabel.TextColor3 = themes.current["text"]
recolorTextLabel(TextLabel)
local textConnection = TextLabel:GetPropertyChangedSignal("TextColor3"):Connect(function()
recolorTextLabel(TextLabel)
end)
local selectConnection = TextLabel.Parent.SelectionHighlight:GetPropertyChangedSignal("Visible"):Connect(function()
recolorTextLabel(TextLabel)
end)
local hoverConnection = TextLabel.Parent.MouseOverHighlight:GetPropertyChangedSignal("Visible"):Connect(function()
recolorTextLabel(TextLabel)
end)
entry[5][#entry[5]+1] = {TextLabel,textConnection,selectConnection,hoverConnection}
end
end
local function recolorInstance(instance)
if instance.BackgroundColor3 == Color3.new(1,1,1) then
instance.BackgroundColor3 = themes.current["zebra_1"]
elseif instance.BackgroundColor3 == Color3.fromRGB(246,246,246) then
instance.BackgroundColor3 = themes.current["zebra_2"]
end
end
local function hookInstance(instance)
recolorInstance(instance)
local textConnection = instance:GetPropertyChangedSignal("TextColor3"):Connect(function()
recolorTextLabel(instance)
end)
local bgConnection = instance:GetPropertyChangedSignal("BackgroundColor3"):Connect(function()
recolorInstance(instance)
end)
entry[6][#entry[6]+1] = {instance,textConnection,bgConnection}
end
for _,child in pairs(instance:GetChildren()) do
if child:IsA("TextButton") then
hookInstance(child)
if child:FindFirstChild("ObjectName") then
hookTextLabel(child.ObjectName)
end
end
end
local connection = instance.ChildAdded:Connect(function(child)
if child:IsA("TextButton") then
hookInstance(child)
if child:FindFirstChild("ObjectName") then
hookTextLabel(child.ObjectName)
end
end
end)
entry[4] = connection
end
local function dynamicBasicObjectsHandlerDisconnect(instance, entry)
if not entry[4] then return end -- If not connected, can't disconnect
entry[4]:Disconnect()
for _,TextLabel in pairs(entry[5]) do
TextLabel[2]:Disconnect() -- TextColor listener
TextLabel[3]:Disconnect() -- Selection listener
TextLabel[4]:Disconnect() -- MouseOver listener
if TextLabel[1] then
TextLabel[1].Font = Enum.Font.SourceSans
TextLabel[1].Parent.NoteLabel.Font = Enum.Font.SourceSans
TextLabel[1].Parent.NoteLabel.TextColor3 = Color3.new(0.5,0.5,0.5)
if TextLabel[1].Parent.MouseOverHighlight.Visible then -- Hovered
TextLabel[1].TextColor3 = Color3.new(0,0,0)
elseif TextLabel[1].Parent.SelectionHighlight.Visible then -- Selected
TextLabel[1].TextColor3 = Color3.new(1,1,1)
else
TextLabel[1].TextColor3 = Color3.new(0,0,0)
end
end
end
for _,InstanceEntry in pairs(entry[6]) do
InstanceEntry[2]:Disconnect() -- Text listener
InstanceEntry[3]:Disconnect() -- BG listener
if InstanceEntry[1] then
if InstanceEntry[1].BackgroundColor3 == themes.current["zebra_1"] then
InstanceEntry[1].BackgroundColor3 = Color3.new(1,1,1)
elseif InstanceEntry[1].BackgroundColor3 == themes.current["zebra_2"] then