-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpyGUI
More file actions
1161 lines (1050 loc) · 52 KB
/
SpyGUI
File metadata and controls
1161 lines (1050 loc) · 52 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
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
repeat task.wait() until game:IsLoaded()
local Players = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local CoreGui = game:GetService("CoreGui")
local LocalPlayer = Players.LocalPlayer
local Workspace = game:GetService("Workspace")
getgenv().MAX_MESSAGES = MAX_MESSAGES or 350
local connections = {}
local currentSpectatedPlayer = nil
local ChatMessages = {}
local FilteredMessages = {}
local shouldAutoScroll = true
local colorCodingEnabled = true
local highlightEnabled = false
local displayedWrappers = {}
local MIN_WIDTH = 350
local MIN_HEIGHT = 200
-- ====================================================================================
-- ESP Variables (State storage moved here)
-- ====================================================================================
local espEnabled = false
local espTeamColors = true
local espShowNameHealth = true
local espObjects = {} -- map player -> UI objects
local espColor = Color3.fromRGB(255, 255, 255)
local espTeamColorDefault = Color3.fromRGB(200, 200, 200)
local ESP_PADDING = 6 -- pixels padding around bounding box
local BORDER_THICKNESS = 2
-- ====================================================================================
local function track(conn)
table.insert(connections, conn)
return conn
end
local ChatLoggerGui = Instance.new("ScreenGui")
ChatLoggerGui.Name = "SpyGUI"
ChatLoggerGui.ResetOnSpawn = false
ChatLoggerGui.DisplayOrder = 100
local ESPGui = Instance.new("ScreenGui")
ESPGui.Name = "ESPHud"
ESPGui.ResetOnSpawn = false
ESPGui.DisplayOrder = 101
local MainFrame = Instance.new("Frame")
MainFrame.Name = "MainFrame"
MainFrame.Size = UDim2.new(0, 350, 0, 340)
MainFrame.AnchorPoint = Vector2.new(0, 1)
MainFrame.Position = UDim2.new(0, 0, 1, -10)
MainFrame.BackgroundColor3 = Color3.fromRGB(34, 34, 36)
MainFrame.BorderSizePixel = 0
MainFrame.Parent = ChatLoggerGui
local TitleBar = Instance.new("Frame")
TitleBar.Name = "TitleBar"
TitleBar.Size = UDim2.new(1, 0, 0, 24)
TitleBar.BackgroundColor3 = Color3.fromRGB(26, 26, 28)
TitleBar.BorderSizePixel = 0
TitleBar.Position = UDim2.new(0, 0, 0, 0)
TitleBar.Parent = MainFrame
local TitleLabel = Instance.new("TextLabel")
TitleLabel.Name = "TitleLabel"
TitleLabel.Size = UDim2.new(1, -90, 1, 0)
TitleLabel.AnchorPoint = Vector2.new(0.5, 0.5)
TitleLabel.Position = UDim2.new(0.5, 0, 0.5, 0)
TitleLabel.TextXAlignment = Enum.TextXAlignment.Center
TitleLabel.TextYAlignment = Enum.TextYAlignment.Center
TitleLabel.BackgroundTransparency = 1
TitleLabel.Text = "Spy Menu"
TitleLabel.TextColor3 = Color3.fromRGB(240, 240, 240)
TitleLabel.TextSize = 14
TitleLabel.Font = Enum.Font.SourceSansBold
TitleLabel.TextXAlignment = Enum.TextXAlignment.Center
TitleLabel.Parent = TitleBar
local CloseButton = Instance.new("TextButton")
CloseButton.Name = "CloseButton"
CloseButton.Size = UDim2.new(0, 24, 0, 24)
CloseButton.Position = UDim2.new(1, -24, 0, 0)
CloseButton.BackgroundTransparency = 1
CloseButton.Text = "X"
CloseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
CloseButton.TextSize = 17
CloseButton.Font = Enum.Font.SourceSansBold
CloseButton.Parent = TitleBar
local HelpButton = Instance.new("TextButton")
HelpButton.Name = "HelpButton"
HelpButton.Size = UDim2.new(0, 24, 0, 24)
HelpButton.Position = UDim2.new(1, -48, 0, 0)
HelpButton.BackgroundTransparency = 1
HelpButton.Text = "?"
HelpButton.TextColor3 = Color3.fromRGB(255, 255, 255)
HelpButton.TextSize = 17
HelpButton.Font = Enum.Font.SourceSansBold
HelpButton.Parent = TitleBar
local TabBar = Instance.new("Frame")
TabBar.Name = "TabBar"
TabBar.Size = UDim2.new(1, 0, 0, 30)
TabBar.Position = UDim2.new(0, 0, 0, 24)
TabBar.BackgroundColor3 = Color3.fromRGB(26, 26, 28)
TabBar.BorderSizePixel = 0
TabBar.Parent = MainFrame
local TabListLayout = Instance.new("UIListLayout")
TabListLayout.FillDirection = Enum.FillDirection.Horizontal
TabListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
TabListLayout.VerticalAlignment = Enum.VerticalAlignment.Center
TabListLayout.Padding = UDim.new(0, 10)
TabListLayout.Parent = TabBar
local function createTabButton(name, text, order)
local button = Instance.new("TextButton")
button.Name = name .. "Button"
button.Size = UDim2.new(0, 120, 0, 24)
button.BackgroundColor3 = defaultValue and Color3.fromRGB(50, 80, 50) or Color3.fromRGB(50, 50, 52)
button.BorderSizePixel = 0
button.Text = text
button.TextColor3 = Color3.fromRGB(240, 240, 240)
button.TextSize = 14
button.Font = Enum.Font.SourceSansBold
button.LayoutOrder = order
button.AutoButtonColor = true
button.Parent = TabBar
return button
end
local ChatTabButton = createTabButton("Chat", "Chat Tracker", 1)
local SpectatorTabButton = createTabButton("Spectator", "Spectator", 2)
-- ====================================================================================
-- Chat Tracker UI (No changes)
-- ====================================================================================
local ChatFrame = Instance.new("Frame")
ChatFrame.Name = "ChatFrame"
ChatFrame.Size = UDim2.new(1, 0, 1, -54)
ChatFrame.Position = UDim2.new(0, 0, 0, 54)
ChatFrame.BackgroundTransparency = 1
ChatFrame.Parent = MainFrame
local SearchBarFrame = Instance.new("Frame")
SearchBarFrame.Name = "SearchBarFrame"
SearchBarFrame.Size = UDim2.new(1, -10, 0, 24)
SearchBarFrame.Position = UDim2.new(0, 5, 0, 0)
SearchBarFrame.BackgroundColor3 = Color3.fromRGB(50, 50, 52)
SearchBarFrame.BorderSizePixel = 0
SearchBarFrame.Parent = ChatFrame
local SearchBar = Instance.new("TextBox")
SearchBar.Name = "SearchBar"
SearchBar.Size = UDim2.new(1, -10, 1, -4)
SearchBar.Position = UDim2.new(0, 5, 0, 2)
SearchBar.BackgroundTransparency = 1
SearchBar.Text = ""
SearchBar.PlaceholderText = "Search..."
SearchBar.TextColor3 = Color3.fromRGB(240, 240, 240)
SearchBar.PlaceholderColor3 = Color3.fromRGB(120, 120, 120)
SearchBar.Font = Enum.Font.SourceSans
SearchBar.TextXAlignment = Enum.TextXAlignment.Left
SearchBar.ClearTextOnFocus = false
SearchBar.TextScaled = true
SearchBar.Parent = SearchBarFrame
local sizeConst = Instance.new("UITextSizeConstraint")
sizeConst.Parent = SearchBar
sizeConst.MaxTextSize = 14
local ChatLogScrollFrame = Instance.new("ScrollingFrame")
ChatLogScrollFrame.Name = "ChatLogScrollFrame"
ChatLogScrollFrame.Size = UDim2.new(1, -10, 1, -90)
ChatLogScrollFrame.Position = UDim2.new(0, 5, 0, 28)
ChatLogScrollFrame.BackgroundColor3 = Color3.fromRGB(34, 34, 36)
ChatLogScrollFrame.BorderSizePixel = 0
ChatLogScrollFrame.ScrollBarThickness = 8
ChatLogScrollFrame.ScrollBarImageColor3 = Color3.fromRGB(100, 100, 100)
ChatLogScrollFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
ChatLogScrollFrame.AutomaticCanvasSize = Enum.AutomaticSize.Y
ChatLogScrollFrame.Parent = ChatFrame
local UIListLayout = Instance.new("UIListLayout")
UIListLayout.Name = "UIListLayout"
UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
UIListLayout.Padding = UDim.new(0, 2)
UIListLayout.Parent = ChatLogScrollFrame
local ControlBar = Instance.new("Frame")
ControlBar.Name = "ControlBar"
ControlBar.Size = UDim2.new(1, 0, 0, 40)
ControlBar.Position = UDim2.new(0, 0, 1, -45)
ControlBar.BackgroundColor3 = Color3.fromRGB(26, 26, 28)
ControlBar.BorderSizePixel = 0
ControlBar.Parent = ChatFrame
local ControlLayout = Instance.new("UIListLayout")
ControlLayout.Name = "ControlLayout"
ControlLayout.FillDirection = Enum.FillDirection.Horizontal
ControlLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
ControlLayout.VerticalAlignment = Enum.VerticalAlignment.Center
ControlLayout.SortOrder = Enum.SortOrder.LayoutOrder
ControlLayout.Padding = UDim.new(0, 10)
ControlLayout.Parent = ControlBar
local function createControlButton(name, text, order)
local button = Instance.new("TextButton")
button.Name = name
button.Size = UDim2.new(0, 70, 0, 24)
button.BackgroundColor3 = Color3.fromRGB(50, 50, 52)
button.BorderSizePixel = 0
button.Text = text
button.TextColor3 = Color3.fromRGB(240, 240, 240)
button.TextSize = 12
button.Font = Enum.Font.SourceSansBold
button.LayoutOrder = order
button.AutoButtonColor = true
button.Parent = ControlBar
return button
end
local ColorToggleButton = createControlButton("ColorToggleButton", "Colors: ON", 1)
local HighlightButton = createControlButton("HighlightButton", "Highlight: OFF", 2)
local CopyButton = createControlButton("CopyButton", "Copy Chat", 3)
local ResetButton = createControlButton("ResetButton", "Reset Position", 4)
local HelpPanel = Instance.new("Frame")
HelpPanel.Name = "HelpPanel"
HelpPanel.Size = UDim2.new(1, -10, 1, -64)
HelpPanel.Position = UDim2.new(0, 5, 0, 29)
HelpPanel.BackgroundColor3 = Color3.fromRGB(40, 40, 42)
HelpPanel.BorderSizePixel = 0
HelpPanel.Visible = false
HelpPanel.Parent = ChatFrame
local HelpScrollFrame = Instance.new("ScrollingFrame")
HelpScrollFrame.Name = "HelpScrollFrame"
HelpScrollFrame.Size = UDim2.new(1, -10, 1, -10)
HelpScrollFrame.Position = UDim2.new(0, 5, 0, 5)
HelpScrollFrame.BackgroundTransparency = 1
HelpScrollFrame.BorderSizePixel = 0
HelpScrollFrame.ScrollBarThickness = 8
HelpScrollFrame.ScrollBarImageColor3 = Color3.fromRGB(100, 100, 100)
HelpScrollFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
HelpScrollFrame.AutomaticCanvasSize = Enum.AutomaticSize.Y
HelpScrollFrame.Parent = HelpPanel
local HelpContentLayout = Instance.new("UIListLayout")
HelpContentLayout.Name = "HelpContentLayout"
HelpContentLayout.SortOrder = Enum.SortOrder.LayoutOrder
HelpContentLayout.Padding = UDim.new(0, 10)
HelpContentLayout.Parent = HelpScrollFrame
-- ====================================================================================
-- Spectator UI (ESP Controls)
-- ====================================================================================
local SpectatorFrame = Instance.new("Frame")
SpectatorFrame.Name = "SpectatorFrame"
SpectatorFrame.Size = UDim2.new(1, 0, 1, -54)
SpectatorFrame.Position = UDim2.new(0, 0, 0, 54)
SpectatorFrame.BackgroundTransparency = 1
SpectatorFrame.Visible = false
SpectatorFrame.Parent = MainFrame
local ControlsSectionFrame = Instance.new("Frame")
ControlsSectionFrame.Name = "ControlsSection"
ControlsSectionFrame.Size = UDim2.new(1, 0, 0, 30) -- Reduced height
ControlsSectionFrame.Position = UDim2.new(0, 0, 0, 0)
ControlsSectionFrame.BackgroundTransparency = 1
ControlsSectionFrame.Parent = SpectatorFrame
local ControlsLayout = Instance.new("UIListLayout")
ControlsLayout.FillDirection = Enum.FillDirection.Horizontal
ControlsLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
ControlsLayout.VerticalAlignment = Enum.VerticalAlignment.Center
ControlsLayout.Padding = UDim.new(0, 10)
ControlsLayout.Parent = ControlsSectionFrame
local ReturnToSelfButton = createControlButton("ReturnToSelf", "Return to Self (F2)", 1)
ReturnToSelfButton.Size = UDim2.new(0, 100, 0, 24)
ReturnToSelfButton.Parent = ControlsSectionFrame
local TeleportButton = createControlButton("TeleportToSpectated", "Teleport (F3)", 2)
TeleportButton.Size = UDim2.new(0, 100, 0, 24)
TeleportButton.Parent = ControlsSectionFrame
local PlayerListSectionTitle = Instance.new("TextLabel")
PlayerListSectionTitle.Name = "PlayerListTitle"
PlayerListSectionTitle.Size = UDim2.new(1, 0, 0, 20)
PlayerListSectionTitle.Position = UDim2.new(0, 0, 0, 35) -- Adjusted position
PlayerListSectionTitle.BackgroundTransparency = 1
PlayerListSectionTitle.Text = "Player List (Click to Spectate)"
PlayerListSectionTitle.TextColor3 = Color3.fromRGB(240, 240, 240)
PlayerListSectionTitle.TextSize = 14
PlayerListSectionTitle.Font = Enum.Font.SourceSansBold
PlayerListSectionTitle.TextXAlignment = Enum.TextXAlignment.Center
PlayerListSectionTitle.Parent = SpectatorFrame
local PlayerListFrame = Instance.new("ScrollingFrame")
PlayerListFrame.Name = "PlayerListFrame"
PlayerListFrame.Size = UDim2.new(1, -10, 1, -95)
PlayerListFrame.Position = UDim2.new(0, 5, 0, 60) -- Adjusted for ESP Controls
PlayerListFrame.BackgroundColor3 = Color3.fromRGB(34, 34, 36)
PlayerListFrame.BorderSizePixel = 0
PlayerListFrame.ScrollBarThickness = 8
PlayerListFrame.ScrollBarImageColor3 = Color3.fromRGB(100, 100, 100)
PlayerListFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
PlayerListFrame.AutomaticCanvasSize = Enum.AutomaticSize.Y
PlayerListFrame.Parent = SpectatorFrame
local PlayerListLayout = Instance.new("UIListLayout")
PlayerListLayout.Name = "PlayerListLayout"
PlayerListLayout.SortOrder = Enum.SortOrder.LayoutOrder
PlayerListLayout.Padding = UDim.new(0, 2)
PlayerListLayout.Parent = PlayerListFrame
local ESPControlBar = Instance.new("Frame")
ESPControlBar.Name = "ESPControlBar"
ESPControlBar.Size = UDim2.new(1, 0, 0, 30)
ESPControlBar.Position = UDim2.new(0, 0, 1, -5)
ESPControlBar.AnchorPoint = Vector2.new(0, 1)
ESPControlBar.BackgroundColor3 = Color3.fromRGB(26, 26, 28)
ESPControlBar.BorderSizePixel = 0
ESPControlBar.Parent = SpectatorFrame
local ESPControlLayout = Instance.new("UIListLayout")
ESPControlLayout.Name = "ESPControlLayout"
ESPControlLayout.FillDirection = Enum.FillDirection.Horizontal
ESPControlLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
ESPControlLayout.VerticalAlignment = Enum.VerticalAlignment.Center
ESPControlLayout.Padding = UDim.new(0, 5)
ESPControlLayout.Parent = ESPControlBar
local function toggleButtonVisuals(button, state)
button.Text = button.Text:gsub("ON", "OFF"):gsub("OFF", "ON")
if state then
button.BackgroundColor3 = Color3.fromRGB(50, 80, 50) -- Greenish when ON
else
button.BackgroundColor3 = Color3.fromRGB(50, 50, 52) -- Default color when OFF
end
end
local function createESPToggle(name, text, defaultValue, order, stateVarName)
local button = Instance.new("TextButton")
button.Name = name
button.Size = UDim2.new(0, 90, 0, 22)
button.BackgroundColor3 = defaultValue and Color3.fromRGB(50, 80, 50) or Color3.fromRGB(50, 50, 52)
button.BorderSizePixel = 0
button.Text = text .. (defaultValue and ": ON" or ": OFF")
button.TextColor3 = Color3.fromRGB(240, 240, 240)
button.TextSize = 12
button.Font = Enum.Font.SourceSansBold
button.LayoutOrder = order
button.AutoButtonColor = true
button.Parent = ESPControlBar
button.MouseButton1Click:Connect(function()
if stateVarName == "espEnabled" then
espEnabled = not espEnabled
toggleButtonVisuals(button, espEnabled)
elseif stateVarName == "espTeamColors" then
espTeamColors = not espTeamColors
toggleButtonVisuals(button, espTeamColors)
elseif stateVarName == "espShowNameHealth" then
espShowNameHealth = not espShowNameHealth
toggleButtonVisuals(button, espShowNameHealth)
end
end)
return button
end
-- ====================================================================================
-- Creating ESP Toggles
-- ====================================================================================
local ESPToggle = createESPToggle("EspToggle", "ESP (Wallhack)", espEnabled, 1, "espEnabled")
local ESPTeamColorsToggle = createESPToggle("EspTeamColorsToggle", "Team Colors", espTeamColors, 2, "espTeamColors")
local ESPNameHealthToggle = createESPToggle("EspShowNameHealthToggle", "Name & Health", espShowNameHealth, 3, "espShowNameHealth")
-- ====================================================================================
-- Helper: Create per-player ESP UI container and elements
-- ====================================================================================
local function createPlayerEspUI(player)
local container = Instance.new("Frame")
container.Name = "ESPContainer_" .. player.Name
container.Size = UDim2.new(0, 0, 0, 0)
container.BackgroundTransparency = 1
container.BorderSizePixel = 0
container.Parent = ESPGui
-- Outline frame (transparent background, UIStroke for border)
local outline = Instance.new("Frame")
outline.Name = "Outline"
outline.BackgroundTransparency = 1
outline.BorderSizePixel = 0
outline.Parent = container
outline.ZIndex = 10
local stroke = Instance.new("UIStroke")
stroke.Parent = outline
stroke.Thickness = BORDER_THICKNESS
stroke.Transparency = 0
stroke.LineJoinMode = Enum.LineJoinMode.Round
-- Fill frame (inside outline)
local fill = Instance.new("Frame")
fill.Name = "Fill"
fill.BorderSizePixel = 0
fill.BackgroundTransparency = 0.6
fill.Parent = outline
fill.ZIndex = 9
-- Name/HP label
local nameLabel = Instance.new("TextLabel")
nameLabel.Name = "NameLabel"
nameLabel.Size = UDim2.new(0, 200, 0, 16)
nameLabel.BackgroundTransparency = 1
nameLabel.Text = ""
nameLabel.TextColor3 = Color3.fromRGB(255,255,255)
nameLabel.TextSize = 14
nameLabel.Font = Enum.Font.SourceSansBold
nameLabel.TextXAlignment = Enum.TextXAlignment.Center
nameLabel.ZIndex = 11
nameLabel.Parent = container
-- Health bar background
local healthBg = Instance.new("Frame")
healthBg.Name = "HealthBg"
healthBg.Size = UDim2.new(0, 60, 0, 6)
healthBg.BackgroundTransparency = 0.6
healthBg.BorderSizePixel = 0
healthBg.Parent = container
healthBg.ZIndex = 11
local healthFill = Instance.new("Frame")
healthFill.Name = "HealthFill"
healthFill.Size = UDim2.new(1,0,1,0)
healthFill.BorderSizePixel = 0
healthFill.BackgroundTransparency = 0
healthFill.Parent = healthBg
return {
container = container,
outline = outline,
stroke = stroke,
fill = fill,
nameLabel = nameLabel,
healthBg = healthBg,
healthFill = healthFill
}
end
-- ====================================================================================
-- Utility: Collect world-space corner points for a model (character)
-- ====================================================================================
local function collectCharacterCorners(character)
local corners = {}
local hrp = character:FindFirstChild("HumanoidRootPart")
if hrp then
local part = hrp -- Используем только HRP
local size = part.Size
local cf = part.CFrame
-- 8 углов относительно части
local offsets = {
Vector3.new(-0.5, -0.5, -0.5), Vector3.new( 0.5, -0.5, -0.5),
Vector3.new(-0.5, 0.5, -0.5), Vector3.new( 0.5, 0.5, -0.5),
Vector3.new(-0.5, -0.5, 0.5), Vector3.new( 0.5, -0.5, 0.5),
Vector3.new(-0.5, 0.5, 0.5), Vector3.new( 0.5, 0.5, 0.5)
}
for _, offset in ipairs(offsets) do
local worldPoint = cf:PointToWorldSpace(offset * size * 2) -- Умножаем на 2, чтобы сделать коробку больше
table.insert(corners, worldPoint)
end
end
return corners
end
-- ====================================================================================
-- ESP Core Logic (Rewritten)
-- ====================================================================================
local camera = Workspace.CurrentCamera
local function updateEspFrame()
if not espEnabled then
-- hide all esp objects
for player, objs in pairs(espObjects) do
if objs and objs.container then
objs.container.Visible = false
end
end
return
end
if not camera then camera = Workspace.CurrentCamera end
if not camera then return end
local viewportSize = camera.ViewportSize
local playersToTrack = {}
for _, player in pairs(Players:GetPlayers()) do
if player ~= LocalPlayer and player.Character and player.Character.Parent and player.Character:FindFirstChild("Humanoid") and player.Character:FindFirstChild("HumanoidRootPart") and player.Character.Humanoid.Health > 0 then
table.insert(playersToTrack, player)
end
end
-- Cleanup unused
local activeMap = {}
for _, p in ipairs(playersToTrack) do activeMap[p] = true end
for p, objs in pairs(espObjects) do
if not activeMap[p] then
if objs.container then objs.container:Destroy() end
espObjects[p] = nil
end
end
-- For each player, compute screen-space bounding box from corners and update UI
for _, player in ipairs(playersToTrack) do
local char = player.Character
if not char then
if espObjects[player] then espObjects[player].container.Visible = false end
continue
end
-- ensure UI exists
if not espObjects[player] then
espObjects[player] = createPlayerEspUI(player)
end
local objs = espObjects[player]
local corners = collectCharacterCorners(char)
local minX, minY = math.huge, math.huge
local maxX, maxY = -math.huge, -math.huge
local anyOnScreen = false
for _, worldPos in ipairs(corners) do
local screenPoint = camera:WorldToScreenPoint(worldPos)
local sx, sy, sz = screenPoint.X, screenPoint.Y, screenPoint.Z
-- WorldToScreenPoint returns a Vector3; .Z being > 0 indicates in front
if sz > 0 then
anyOnScreen = true
if sx < minX then minX = sx end
if sy < minY then minY = sy end
if sx > maxX then maxX = sx end
if sy > maxY then maxY = sy end
end
end
if not anyOnScreen then
-- hide
objs.container.Visible = false
else
-- clamp to viewport (optional)
local left = math.floor(math.max(0, minX - ESP_PADDING))
local top = math.floor(math.max(0, minY - ESP_PADDING))
local right = math.floor(math.min(viewportSize.X, maxX + ESP_PADDING))
local bottom = math.floor(math.min(viewportSize.Y, maxY + ESP_PADDING))
local width = math.max(2, right - left)
local height = math.max(2, bottom - top)
-- Colors
local color = espColor
if espTeamColors and player.Team then
pcall(function() color = player.Team.TeamColor.Color end)
end
if not color then color = espTeamColorDefault end
-- Update outline frame and stroke
objs.outline.Position = UDim2.new(0, left, 0, top)
objs.outline.Size = UDim2.new(0, width, 0, height)
objs.stroke.Color = color
objs.stroke.Transparency = 0
objs.outline.BackgroundTransparency = 1
-- Fill: slightly inset to show border
local inset = BORDER_THICKNESS
objs.fill.Position = UDim2.new(0, inset, 0, inset)
objs.fill.Size = UDim2.new(1, -(inset * 2), 1, -(inset * 2))
if espTeamColors then
objs.fill.BackgroundColor3 = color
else
objs.fill.BackgroundColor3 = Color3.fromRGB(160, 160, 160)
end
objs.fill.BackgroundTransparency = 0.6
-- Name & Health
if espShowNameHealth and char:FindFirstChild("Humanoid") then
local humanoid = char.Humanoid
local hp = math.max(0, math.floor(humanoid.Health))
local maxHp = math.max(1, math.floor(humanoid.MaxHealth))
local displayName = player.DisplayName or player.Name
objs.nameLabel.Text = string.format("%s [HP: %d/%d]", displayName, hp, maxHp)
objs.nameLabel.TextColor3 = color
-- position name centered above the box
objs.nameLabel.Position = UDim2.new(0, left + math.floor((width - objs.nameLabel.AbsoluteSize.X) / 2), 0, top - 18)
objs.nameLabel.Size = UDim2.new(0, math.clamp(width, 40, 400), 0, 16)
objs.nameLabel.Visible = true
-- health bar below the name
local healthRatio = math.clamp(humanoid.Health / humanoid.MaxHealth, 0, 1)
objs.healthBg.Position = UDim2.new(0, left + math.floor((width - objs.healthBg.Size.X.Offset) / 2), 0, top - 4)
objs.healthBg.Visible = true
objs.healthFill.Size = UDim2.new(healthRatio, 0, 1, 0)
-- health color gradient (green to red)
local hue = math.clamp(healthRatio * 0.35, 0, 0.35)
objs.healthFill.BackgroundColor3 = Color3.fromHSV(hue, 1, 1)
else
objs.nameLabel.Visible = false
objs.healthBg.Visible = false
end
objs.container.Visible = true
end
end
end
-- Use RenderStepped for smooth GUI following camera
local lastESPUpdate = 0
track(RunService.RenderStepped:Connect(function(dt)
lastESPUpdate += dt
if lastESPUpdate >= 0.03 then
lastESPUpdate = 0
local ok, err = pcall(updateEspFrame)
if not ok then
warn("ESP update error:", err)
end
end
end))
-- ====================================================================================
local function spectatePlayer(playerName)
local targetPlayer = Players:FindFirstChild(playerName)
if targetPlayer and targetPlayer.Character and targetPlayer.Character:FindFirstChild("Humanoid") then
workspace.CurrentCamera.CameraSubject = targetPlayer.Character:FindFirstChild("Humanoid")
currentSpectatedPlayer = targetPlayer
warn("Now spectating: " .. targetPlayer.DisplayName .. " (@" .. targetPlayer.Name .. ")")
else
warn("Error: Player " .. playerName .. " not found or no Humanoid.")
end
end
local function returnToSelf()
if LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("Humanoid") then
workspace.CurrentCamera.CameraSubject = LocalPlayer.Character:FindFirstChild("Humanoid")
currentSpectatedPlayer = nil
warn("Returned to your character.")
end
end
local function teleportToSpectatedPlayer()
if currentSpectatedPlayer and currentSpectatedPlayer.Character then
local targetRootPart = currentSpectatedPlayer.Character:FindFirstChild("HumanoidRootPart")
local localRootPart = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
if targetRootPart and localRootPart then
localRootPart.CFrame = targetRootPart.CFrame
warn("Teleported to " .. currentSpectatedPlayer.DisplayName .. " (@" .. currentSpectatedPlayer.Name .. ")")
else
warn("Error: Spectated player or your character doesn't have a HumanoidRootPart.")
end
else
warn("Error: You aren't spectating anyone.")
end
end
local function populatePlayerList()
for _, child in pairs(PlayerListFrame:GetChildren()) do
if child:IsA("TextButton") then
child:Destroy()
end
end
local players = Players:GetPlayers()
table.sort(players, function(a, b)
return a.Name:lower() < b.Name:lower()
end)
for index, player in pairs(players) do
if player ~= LocalPlayer then
local button = Instance.new("TextButton")
button.Name = "PlayerButton"
button.Size = UDim2.new(1, -10, 0, 24)
button.Position = UDim2.new(0, 5, 0, 0)
button.BackgroundTransparency = 1
button.Text = player.DisplayName .. " (@" .. player.Name .. ")"
button.TextColor3 = Color3.fromRGB(240, 240, 240)
button.TextSize = 14
button.Font = Enum.Font.SourceSans
button.TextXAlignment = Enum.TextXAlignment.Left
button.AutoButtonColor = true
button.Parent = PlayerListFrame
button.LayoutOrder = index
button.MouseButton1Click:Connect(function()
spectatePlayer(player.Name)
end)
end
end
end
local function getPlayerPosition(player)
if player and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
return player.Character.HumanoidRootPart.Position
end
return nil
end
local function getAllPlayersPositions()
local positions = {}
for _, player in pairs(Players:GetPlayers()) do
local position = getPlayerPosition(player)
if position then
positions[player.Name:lower()] = {
position = position,
playerName = player.Name,
displayName = player.DisplayName
}
if player.DisplayName ~= player.Name then
positions[player.DisplayName:lower()] = {
position = position,
playerName = player.Name,
displayName = player.DisplayName
}
end
end
end
return positions
end
local function createHelpSection(title, content, layoutOrder)
local section = Instance.new("Frame")
section.Name = "HelpSection_" .. title:gsub("%s+", "")
section.Size = UDim2.new(1, 0, 0, 0)
section.BackgroundTransparency = 1
section.LayoutOrder = layoutOrder
section.AutomaticSize = Enum.AutomaticSize.Y
section.Parent = HelpScrollFrame
local sectionTitle = Instance.new("TextLabel")
sectionTitle.Name = "Title"
sectionTitle.Size = UDim2.new(1, -16, 0, 24)
sectionTitle.Position = UDim2.new(0, 5, 0, 0)
sectionTitle.BackgroundTransparency = 1
sectionTitle.Text = title
sectionTitle.TextColor3 = Color3.fromRGB(255, 255, 255)
sectionTitle.TextSize = 16
sectionTitle.Font = Enum.Font.SourceSansBold
sectionTitle.TextXAlignment = Enum.TextXAlignment.Left
sectionTitle.Parent = section
local sectionContent = Instance.new("TextLabel")
sectionContent.Name = "Content"
sectionContent.Size = UDim2.new(1, -16, 0, 0)
sectionContent.Position = UDim2.new(0, 5, 0, 24)
sectionContent.BackgroundTransparency = 1
sectionContent.Text = content
sectionContent.TextColor3 = Color3.fromRGB(220, 220, 220)
sectionContent.TextSize = 14
sectionContent.Font = Enum.Font.SourceSans
sectionContent.TextXAlignment = Enum.TextXAlignment.Left
sectionContent.TextYAlignment = Enum.TextYAlignment.Top
sectionContent.TextWrapped = true
sectionContent.AutomaticSize = Enum.AutomaticSize.Y
sectionContent.Parent = section
return section
end
local function populateHelpContent()
for _, child in pairs(HelpScrollFrame:GetChildren()) do if child:IsA("Frame") then child:Destroy() end end
createHelpSection("Chat Tracker Helper", " ", 1)
createHelpSection("Basic Usage", "Press Shift+B to toggle the window\nPress Shift+R to reset menu position\nDrag the title bar to move the window\nDrag the borders to resize the window", 2)
createHelpSection("Search Filters", "You can use special filters in the search bar:\n• Type text to find messages containing that text\n• Use quotes for phrases: \"hello world\"\n• Team filter: %team (e.g., %red)\n• Player filter: ?name (e.g., ?bbutcher_0)\n• Word filter: *word (matches whole word only)\n• Proximity filter: ~distance (e.g., ~50)\n• Player proximity: player~distance (e.g., bbutcher_0~100)", 3)
createHelpSection("Search Operators", "Combine search terms with operators:\n• AND: requires both terms (e.g., hello AND world)\n• OR: matches either term (e.g., hello OR world)\n• NOT: excludes matches (e.g., hello AND NOT world)\n• Parentheses for grouping: (hello OR hi) AND world\nMultiple terms have an implicit OR between them\nSearches are case insensitive, except operators must be UPPERCASE", 4)
createHelpSection("Examples", "• Find messages from RedTeam: %red\n• Find messages from player starting with \"J\": ?j\n• Find \"hello\" but not \"world\": hello AND NOT world\n• Find messages about food from Team Red: %red AND (pizza OR burger)\n• Find messages from players within 100 studs of you: ~100\n• Find messages from players within 50 studs of bbutcher_0: bbutcher_0~50", 5)
createHelpSection("Proximity Filter", "The proximity filter shows messages from players who were within specified distance when they sent the message:\n• ~50: players within 50 studs of you\n• bbutcher_0~100: players within 100 studs of player \"bbutcher_0\"\n• Player names can be partial (e.g., \"j~50\" matches \"bbutcher_0\")\n• Uses positions at the time the message was sent, not current positions\n• If no matching player is found for player~distance, no results are shown", 6)
createHelpSection("Controls", "• Colors: Toggle team color indicators\n• Copy Chat: Copy filtered messages to clipboard\n• Highlight: Toggle highlighting of filtered messages", 7)
createHelpSection("Spectator Helper", " ", 8)
createHelpSection("Basic", "Press F1 to start spectating a random player\nPress F2 to return to your own character\nPress F3 to teleport to the player you are spectating\nSwitch to the Spectator tab in the menu to see a full list of players\nClick on any player's name in the list to begin watching them", 9)
createHelpSection("In-Menu Controls", "Return to Self: Same function as the F2 key, returning the camera to your character\nTeleport to Spectated: Same function as the F3 key, teleporting you to the player you're watching", 10)
createHelpSection("ESP (Wallhack)", "Use the toggles at the bottom of the Spectator tab to enable/disable the ESP:\n• ESP (Wallhack): Toggle the box visualization on all players.\n• Team Colors: If ON, the box color is based on the player's team color.\n• Name & Health: If ON, displays the player's name and current health.", 11) -- Added description
HelpScrollFrame.CanvasSize = UDim2.new(0, 0, 0, HelpContentLayout.AbsoluteContentSize.Y + 10)
end
local function createChatMessageEntry(player, message, teamColor)
local timeStamp = os.date("%H:%M:%S")
local teamName = player.Team and player.Team.Name or "No Team"
local teamColorValue = teamColor or Color3.fromRGB(200, 200, 200)
local senderPosition = getPlayerPosition(player)
local localPlayerPosition = getPlayerPosition(LocalPlayer)
local allPlayerPositions = getAllPlayersPositions()
local entry = {
playerName = player.Name,
displayName = player.DisplayName,
message = message,
teamName = teamName,
teamColor = teamColorValue,
timeStamp = timeStamp,
layoutOrder = #ChatMessages + 1,
tweened = false,
senderPosition = senderPosition,
localPlayerPosition = localPlayerPosition,
allPlayerPositions = allPlayerPositions,
}
table.insert(ChatMessages, entry)
return entry
end
local function createMessageElement(messageData)
local wrapper = Instance.new("Frame")
wrapper.Name = "MessageWrapper"
wrapper.Size = UDim2.new(1, 0, 0, 0)
wrapper.BackgroundTransparency = 1
wrapper.BorderSizePixel = 0
wrapper.LayoutOrder = messageData.layoutOrder
wrapper.AutomaticSize = Enum.AutomaticSize.Y
local inner = Instance.new("Frame")
inner.Name = "InnerFrame"
inner.Size = UDim2.new(1, 0, 0, 20)
inner.Position = UDim2.new(-1, 0, 0, 0)
inner.BackgroundTransparency = 1
inner.BorderSizePixel = 0
inner.AutomaticSize = Enum.AutomaticSize.Y
inner.Parent = wrapper
local TimeLabel = Instance.new("TextLabel")
TimeLabel.Name = "TimeLabel"
TimeLabel.Size = UDim2.new(0, 50, 1, 0)
TimeLabel.Position = UDim2.new(0, 4, 0, 0)
TimeLabel.BackgroundTransparency = 1
TimeLabel.Text = messageData.timeStamp
TimeLabel.TextColor3 = Color3.fromRGB(150, 150, 150)
TimeLabel.TextSize = 13
TimeLabel.Font = Enum.Font.SourceSans
TimeLabel.TextXAlignment = Enum.TextXAlignment.Left
TimeLabel.Parent = inner
local TeamColorIndicator = Instance.new("Frame")
TeamColorIndicator.Name = "TeamColorIndicator"
TeamColorIndicator.Size = UDim2.new(0, 3, 1, -4)
TeamColorIndicator.Position = UDim2.new(0, 45, 0, 2)
TeamColorIndicator.BackgroundColor3 = messageData.teamColor
TeamColorIndicator.BorderSizePixel = 0
TeamColorIndicator.Visible = colorCodingEnabled
TeamColorIndicator.Parent = inner
local PlayerAndMessage = Instance.new("TextLabel")
PlayerAndMessage.Name = "PlayerAndMessage"
PlayerAndMessage.Size = UDim2.new(1, -80, 0, 0)
local xOffset = colorCodingEnabled and 53 or 45
PlayerAndMessage.Position = UDim2.new(0, xOffset, 0, 2)
PlayerAndMessage.BackgroundTransparency = 1
PlayerAndMessage.Text = string.format("[%s]: %s", messageData.playerName, messageData.message)
PlayerAndMessage.TextColor3 = Color3.fromRGB(240, 240, 240)
PlayerAndMessage.TextSize = 14
PlayerAndMessage.Font = Enum.Font.SourceSans
PlayerAndMessage.TextXAlignment = Enum.TextXAlignment.Left
PlayerAndMessage.TextWrapped = true
PlayerAndMessage.AutomaticSize = Enum.AutomaticSize.Y
PlayerAndMessage.Parent = inner
return wrapper
end
local function tokenize(str)
local tokens = {}
local i = 1
while i <= #str do
local c = str:sub(i,i)
if c:match("%s") then i = i + 1
elseif (c == "%" or c == "?" or c == "*" or c == "~") and (str:sub(i+1,i+1) == '"' or str:sub(i+1,i+1) == "'") then
local prefix = c; local quote = str:sub(i+1,i+1); local j = str:find(quote, i+2, true) or (#str + 1); local content= str:sub(i+2, j-1)
table.insert(tokens, { type = "term", value = prefix .. content }); i = j + 1
elseif c == '"' or c == "'" then
local quote = c; local j = str:find(quote, i+1, true) or (#str + 1); local content = str:sub(i+1, j-1)
table.insert(tokens, { type = "term", value = content }); i = j + 1
elseif str:sub(i,i+2) == "AND" and (i+3 > #str or str:sub(i+3,i+3):match("%s")) then
table.insert(tokens, { type = "op", value = "AND" }); i = i + 3
elseif str:sub(i,i+1) == "OR" and (i+2 > #str or str:sub(i+2,i+2):match("%s")) then
table.insert(tokens, { type = "op", value = "OR" }); i = i + 2
elseif str:sub(i,i+2) == "NOT" and (i+3 > #str or str:sub(i+3,i+3):match("%s")) then
table.insert(tokens, { type = "op", value = "NOT" }); i = i + 3
elseif c == "(" or c == ")" then
table.insert(tokens, { type = c }); i = i + 1
else
local j = str:find("[%s%(%)]", i) or (#str + 1); local term = str:sub(i, j-1)
table.insert(tokens, { type = "term", value = term }); i = j
end
end
local out = {}; for idx = 1, #tokens do table.insert(out, tokens[idx]); local cur, nxt = tokens[idx], tokens[idx+1]; if cur and nxt and (cur.type == "term" or cur.type == ")") and (nxt.type == "term" or nxt.type == "(") then table.insert(out, { type = "op", value = "OR" }) end end
return out
end
local function parseExpression(tokens)
local pos = 1
local function peek() return tokens[pos] end
local function consume(expected) local t = tokens[pos]; if not t or (expected and t.type ~= expected and t.value ~= expected) then error("Parse error, expected "..expected) end; pos = pos + 1; return t end
local function parsePrimary()
local t = peek(); if not t then error("Unexpected EOF") end
if t.type == "(" then consume("("); local node = parseExpr(); consume(")"); return node
elseif t.type == "term" then consume(); return { kind = "term", raw = t.value }
else error("Unexpected token in primary: "..t.type) end
end
local function parseFactor()
local negations = 0; while peek() and peek().type == "op" and peek().value == "NOT" do consume("op"); negations = negations + 1 end
local node = parsePrimary(); if negations % 2 == 1 then node = { kind = "not", child = node } end
return node
end
local function parseTermRule()
local node = parseFactor(); while peek() and peek().type == "op" and peek().value == "AND" do consume("op"); node = { kind = "and", left = node, right = parseFactor() } end
return node
end
function parseExpr()
local node = parseTermRule(); while peek() and peek().type == "op" and peek().value == "OR" do consume("op"); node = { kind = "or", left = node, right = parseTermRule() } end
return node
end
local tree = parseExpr(); if pos <= #tokens then error("Unexpected extra token: "..tokens[pos].value) end
return tree
end
local function matchTerm(msg, raw)
if raw:sub(1,1) == "\\" then raw = raw:sub(2); return msg.message:lower():find(raw:lower(),1,true) ~= nil end
local tildePos = raw:find("~"); if tildePos then
local playerPart = raw:sub(1, tildePos - 1); local distancePart = raw:sub(tildePos + 1); local distance = tonumber(distancePart)
if not distance then return false end
if playerPart == "" then
if not msg.senderPosition or not msg.localPlayerPosition then return false end; local actualDistance = (msg.senderPosition - msg.localPlayerPosition).Magnitude
return actualDistance <= distance
else
local targetPlayerData = nil; local searchTerm = playerPart:lower()
for playerKey, playerData in pairs(msg.allPlayerPositions) do if playerKey:match("^"..searchTerm) then targetPlayerData = playerData; break end end
if not targetPlayerData or not targetPlayerData.position or not msg.senderPosition then return false end
local actualDistance = (msg.senderPosition - targetPlayerData.position).Magnitude; return actualDistance <= distance
end
end
local pfx = raw:sub(1,1); local term = raw:sub(2):lower()
if pfx == "%" then return msg.teamName:lower():find(term,1,true)
elseif pfx == "?" then local pl = msg.playerName:lower(); local dn = msg.displayName:lower(); return pl:match("^"..term) or dn:match("^"..term)
elseif pfx == "*" then return msg.message:lower():find("%f[%w]"..term.."%f[%W]")
else term = raw:lower(); return msg.message:lower():find(term,1,true) end
end
local function eval(node, msg)
if node.kind == "term" then return matchTerm(msg, node.raw)
elseif node.kind == "not" then return not eval(node.child, msg)
elseif node.kind == "and" then return eval(node.left, msg) and eval(node.right, msg)
elseif node.kind == "or" then return eval(node.left, msg) or eval(node.right, msg)
else error("Unknown AST node: "..tostring(node.kind)) end
end
local function applyFilters(searchText)
if searchText:match("^%s*$") then
FilteredMessages = {}; for i = #ChatMessages, 1, -1 do local msg = ChatMessages[i]; table.insert(FilteredMessages, msg); if #FilteredMessages >= getgenv().MAX_MESSAGES then break end end
for i = 1, math.floor(#FilteredMessages / 2) do FilteredMessages[i], FilteredMessages[#FilteredMessages - i + 1] = FilteredMessages[#FilteredMessages - i + 1], FilteredMessages[i] end
return
end
local ok, tree = pcall(function() local toks = tokenize(searchText); return parseExpression(toks) end)
if not ok then FilteredMessages = {}; return end
FilteredMessages = {}; for i = #ChatMessages, 1, -1 do local msg = ChatMessages[i]; if eval(tree, msg) then table.insert(FilteredMessages, msg) end; if #FilteredMessages >= getgenv().MAX_MESSAGES then break end end
for i = 1, math.floor(#FilteredMessages / 2) do FilteredMessages[i], FilteredMessages[#FilteredMessages - i + 1] = FilteredMessages[#FilteredMessages - i + 1], FilteredMessages[i] end
end
local function tail(list, n)
local len = #list; local start = math.max(1, len - n + 1); local out = {}; for i = start, len do out[#out + 1] = list[i] end
return out
end
local function updateMessageDisplay()
local baseList = highlightEnabled and tail(ChatMessages, getgenv().MAX_MESSAGES) or FilteredMessages
local passesFilter = {}; for _, msg in ipairs(baseList) do passesFilter[msg] = true end
for idx, msgData in ipairs(baseList) do
local wrapper = displayedWrappers[msgData]; if not wrapper then
wrapper = createMessageElement(msgData); wrapper.Parent = ChatLogScrollFrame; displayedWrappers[msgData] = wrapper
local inner = wrapper:FindFirstChild("InnerFrame"); if msgData == ChatMessages[#ChatMessages] then TweenService:Create(inner, TweenInfo.new(0.3, Enum.EasingStyle.Quad), { Position = UDim2.new(0, 0, 0, 0), }):Play()
else inner.Position = UDim2.new(0, 0, 0, 0) end
end
wrapper.LayoutOrder = idx; wrapper.Visible = true; local inner = wrapper:FindFirstChild("InnerFrame"); local indicator = inner:FindFirstChild("TeamColorIndicator")
if indicator then indicator.Visible = colorCodingEnabled end; local label = inner:FindFirstChild("PlayerAndMessage")
if label then local xOffset = colorCodingEnabled and 53 or 45; label.Position = UDim2.new(0, xOffset, 0, 2) end
if highlightEnabled and not SearchBar.Text:match("^%s*$") and table.find(FilteredMessages, msgData) then
inner.BackgroundTransparency = 0.8; inner.BackgroundColor3 = Color3.fromRGB(255, 255, 0)
else inner.BackgroundTransparency = 1 end
end
for msgData, wrapper in pairs(displayedWrappers) do if not passesFilter[msgData] then wrapper:Destroy(); displayedWrappers[msgData] = nil end end
ChatLogScrollFrame.CanvasSize = UDim2.new(0, 0, 0, UIListLayout.AbsoluteContentSize.Y)
if shouldAutoScroll then local y = math.max(0, UIListLayout.AbsoluteContentSize.Y - ChatLogScrollFrame.AbsoluteSize.Y); ChatLogScrollFrame.CanvasPosition = Vector2.new(0, y) end
end
local function toggleHelpPanel()
HelpPanel.Visible = not HelpPanel.Visible
ChatLogScrollFrame.Visible = not HelpPanel.Visible
SearchBarFrame.Visible = not HelpPanel.Visible
ControlBar.Visible = not HelpPanel.Visible
if HelpPanel.Visible then populateHelpContent() end
end
local function copyChatsToClipboard()
local textToCopy = ""; if colorCodingEnabled then
for _, msgData in ipairs(FilteredMessages) do textToCopy = textToCopy .. string.format("[%s] [%s] [%s]: %s\n", msgData.timeStamp, msgData.teamName, msgData.playerName, msgData.message) end
else
for _, msgData in ipairs(FilteredMessages) do textToCopy = textToCopy .. string.format("[%s] [%s]: %s\n", msgData.timeStamp, msgData.playerName, msgData.message) end
end
if textToCopy == "" then textToCopy = "No messages to copy." end