forked from ivannetta/ShitScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsiri.lua
More file actions
745 lines (659 loc) · 23.7 KB
/
siri.lua
File metadata and controls
745 lines (659 loc) · 23.7 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
--!nocheck
--!nolint
-- services
local runService = game:GetService("RunService")
local players = game:GetService("Players")
local workspace = game:GetService("Workspace")
-- variables
local localPlayer = players.LocalPlayer
local camera = workspace.CurrentCamera
local viewportSize = camera.ViewportSize
local container = Instance.new("Folder", gethui and gethui() or game:GetService("CoreGui"))
-- locals
local floor = math.floor
local round = math.round
local sin = math.sin
local cos = math.cos
local clear = table.clear
local unpack = table.unpack
local find = table.find
local create = table.create
local fromMatrix = CFrame.fromMatrix
-- methods
local wtvp = camera.WorldToViewportPoint
local isA = workspace.IsA
local getPivot = workspace.GetPivot
local findFirstChild = workspace.FindFirstChild
local findFirstChildOfClass = workspace.FindFirstChildOfClass
local getChildren = workspace.GetChildren
local toOrientation = CFrame.identity.ToOrientation
local pointToObjectSpace = CFrame.identity.PointToObjectSpace
local lerpColor = Color3.new().Lerp
local min2 = Vector2.zero.Min
local max2 = Vector2.zero.Max
local lerp2 = Vector2.zero.Lerp
local min3 = Vector3.zero.Min
local max3 = Vector3.zero.Max
-- constants
local HEALTH_BAR_OFFSET = Vector2.new(5, 0)
local HEALTH_TEXT_OFFSET = Vector2.new(3, 0)
local HEALTH_BAR_OUTLINE_OFFSET = Vector2.new(0, 1)
local NAME_OFFSET = Vector2.new(0, 2)
local DISTANCE_OFFSET = Vector2.new(0, 2)
local VERTICES = {
Vector3.new(-1, -1, -1),
Vector3.new(-1, 1, -1),
Vector3.new(-1, 1, 1),
Vector3.new(-1, -1, 1),
Vector3.new(1, -1, -1),
Vector3.new(1, 1, -1),
Vector3.new(1, 1, 1),
Vector3.new(1, -1, 1),
}
-- functions
local function isBodyPart(name)
return name == "Head" or name:find("Torso") or name:find("Leg") or name:find("Arm")
end
local function getBoundingBox(parts)
local min, max
for i = 1, #parts do
local part = parts[i]
local cframe, size = part.CFrame, part.Size
min = min3(min or cframe.Position, (cframe - size * 0.5).Position)
max = max3(max or cframe.Position, (cframe + size * 0.5).Position)
end
local center = (min + max) * 0.5
local front = Vector3.new(center.X, center.Y, max.Z)
return CFrame.new(center, front), max - min
end
local function worldToScreen(world)
local screen, inBounds = wtvp(camera, world)
return Vector2.new(screen.X, screen.Y), inBounds, screen.Z
end
local function calculateCorners(cframe, size)
local corners = create(#VERTICES)
for i = 1, #VERTICES do
corners[i] = worldToScreen((cframe + size * 0.5 * VERTICES[i]).Position)
end
local min = min2(viewportSize, unpack(corners))
local max = max2(Vector2.zero, unpack(corners))
return {
corners = corners,
topLeft = Vector2.new(floor(min.X), floor(min.Y)),
topRight = Vector2.new(floor(max.X), floor(min.Y)),
bottomLeft = Vector2.new(floor(min.X), floor(max.Y)),
bottomRight = Vector2.new(floor(max.X), floor(max.Y)),
}
end
local function rotateVector(vector, radians)
-- https://stackoverflow.com/questions/28112315/how-do-i-rotate-a-vector
local x, y = vector.X, vector.Y
local c, s = cos(radians), sin(radians)
return Vector2.new(x * c - y * s, x * s + y * c)
end
local function parseColor(self, color, isOutline)
if color == "Team Color" or (self.interface.sharedSettings.useTeamColor and not isOutline) then
return self.interface.getTeamColor(self.player) or Color3.new(1, 1, 1)
end
return color
end
-- esp object
local EspObject = {}
EspObject.__index = EspObject
function EspObject.new(player, interface)
local self = setmetatable({}, EspObject)
self.player = assert(player, "Missing argument #1 (Player expected)")
self.interface = assert(interface, "Missing argument #2 (table expected)")
self:Construct()
return self
end
function EspObject:_create(class, properties)
local drawing = Drawing.new(class)
for property, value in next, properties do
pcall(function()
drawing[property] = value
end)
end
self.bin[#self.bin + 1] = drawing
return drawing
end
function EspObject:Construct()
self.charCache = {}
self.childCount = 0
self.bin = {}
self.drawings = {
box3d = {
{
self:_create("Line", { Thickness = 1, Visible = false }),
self:_create("Line", { Thickness = 1, Visible = false }),
self:_create("Line", { Thickness = 1, Visible = false }),
},
{
self:_create("Line", { Thickness = 1, Visible = false }),
self:_create("Line", { Thickness = 1, Visible = false }),
self:_create("Line", { Thickness = 1, Visible = false }),
},
{
self:_create("Line", { Thickness = 1, Visible = false }),
self:_create("Line", { Thickness = 1, Visible = false }),
self:_create("Line", { Thickness = 1, Visible = false }),
},
{
self:_create("Line", { Thickness = 1, Visible = false }),
self:_create("Line", { Thickness = 1, Visible = false }),
self:_create("Line", { Thickness = 1, Visible = false }),
},
},
visible = {
tracerOutline = self:_create("Line", { Thickness = 3, Visible = false }),
tracer = self:_create("Line", { Thickness = 1, Visible = false }),
boxFill = self:_create("Square", { Filled = true, Visible = false }),
boxOutline = self:_create("Square", { Thickness = 3, Visible = false }),
box = self:_create("Square", { Thickness = 1, Visible = false }),
healthBarOutline = self:_create("Line", { Thickness = 3, Visible = false }),
healthBar = self:_create("Line", { Thickness = 1, Visible = false }),
healthText = self:_create("Text", { Center = true, Visible = false }),
name = self:_create("Text", { Text = self.player.DisplayName, Center = true, Visible = false }),
distance = self:_create("Text", { Center = true, Visible = false }),
weapon = self:_create("Text", { Center = true, Visible = false }),
},
hidden = {
arrowOutline = self:_create("Triangle", { Thickness = 3, Visible = false }),
arrow = self:_create("Triangle", { Filled = true, Visible = false }),
},
}
self.renderConnection = runService.Heartbeat:Connect(function(deltaTime)
self:Update(deltaTime)
self:Render(deltaTime)
end)
end
function EspObject:Destruct()
self.renderConnection:Disconnect()
for i = 1, #self.bin do
self.bin[i]:Remove()
end
clear(self)
end
function EspObject:Update()
local interface = self.interface
self.options = interface.teamSettings[interface.isFriendly(self.player) and "friendly" or "enemy"]
self.character = interface.getCharacter(self.player)
self.health, self.maxHealth = interface.getHealth(self.player)
self.weapon = interface.getWeapon(self.player)
self.enabled = self.options.enabled
and self.character
and not (#interface.whitelist > 0 and not find(interface.whitelist, self.player.UserId))
local head = self.enabled and findFirstChild(self.character, "Head")
if not head then
self.charCache = {}
self.onScreen = false
return
end
local _, onScreen, depth = worldToScreen(head.Position)
self.onScreen = onScreen
self.distance = depth
if interface.sharedSettings.limitDistance and depth > interface.sharedSettings.maxDistance then
self.onScreen = false
end
if self.onScreen then
local cache = self.charCache
local children = getChildren(self.character)
if not cache[1] or self.childCount ~= #children then
clear(cache)
for i = 1, #children do
local part = children[i]
if isA(part, "BasePart") and isBodyPart(part.Name) then
cache[#cache + 1] = part
end
end
self.childCount = #children
end
self.corners = calculateCorners(getBoundingBox(cache))
elseif self.options.offScreenArrow then
local cframe = camera.CFrame
local flat = fromMatrix(cframe.Position, cframe.RightVector, Vector3.yAxis)
local objectSpace = pointToObjectSpace(flat, head.Position)
self.direction = Vector2.new(objectSpace.X, objectSpace.Z).Unit
end
end
function EspObject:Render()
local onScreen = self.onScreen or false
local enabled = self.enabled or false
local visible = self.drawings.visible
local hidden = self.drawings.hidden
local box3d = self.drawings.box3d
local interface = self.interface
local options = self.options
local corners = self.corners
visible.box.Visible = enabled and onScreen and options.box
visible.boxOutline.Visible = visible.box.Visible and options.boxOutline
if visible.box.Visible then
local box = visible.box
box.Position = corners.topLeft
box.Size = corners.bottomRight - corners.topLeft
box.Color = parseColor(self, options.boxColor[1])
box.Transparency = options.boxColor[2]
local boxOutline = visible.boxOutline
boxOutline.Position = box.Position
boxOutline.Size = box.Size
boxOutline.Color = parseColor(self, options.boxOutlineColor[1], true)
boxOutline.Transparency = options.boxOutlineColor[2]
end
visible.boxFill.Visible = enabled and onScreen and options.boxFill
if visible.boxFill.Visible then
local boxFill = visible.boxFill
boxFill.Position = corners.topLeft
boxFill.Size = corners.bottomRight - corners.topLeft
boxFill.Color = parseColor(self, options.boxFillColor[1])
boxFill.Transparency = options.boxFillColor[2]
end
visible.healthBar.Visible = enabled and onScreen and options.healthBar
visible.healthBarOutline.Visible = visible.healthBar.Visible and options.healthBarOutline
if visible.healthBar.Visible then
local barFrom = corners.topLeft - HEALTH_BAR_OFFSET
local barTo = corners.bottomLeft - HEALTH_BAR_OFFSET
local healthBar = visible.healthBar
healthBar.To = barTo
healthBar.From = lerp2(barTo, barFrom, self.health / self.maxHealth)
healthBar.Color = lerpColor(options.dyingColor, options.healthyColor, self.health / self.maxHealth)
local healthBarOutline = visible.healthBarOutline
healthBarOutline.To = barTo + HEALTH_BAR_OUTLINE_OFFSET
healthBarOutline.From = barFrom - HEALTH_BAR_OUTLINE_OFFSET
healthBarOutline.Color = parseColor(self, options.healthBarOutlineColor[1], true)
healthBarOutline.Transparency = options.healthBarOutlineColor[2]
end
visible.healthText.Visible = enabled and onScreen and options.healthText
if visible.healthText.Visible then
local barFrom = corners.topLeft - HEALTH_BAR_OFFSET
local barTo = corners.bottomLeft - HEALTH_BAR_OFFSET
local healthText = visible.healthText
healthText.Text = round(self.health) .. "hp"
healthText.Size = interface.sharedSettings.textSize
healthText.Font = interface.sharedSettings.textFont
healthText.Color = parseColor(self, options.healthTextColor[1])
healthText.Transparency = options.healthTextColor[2]
healthText.Outline = options.healthTextOutline
healthText.OutlineColor = parseColor(self, options.healthTextOutlineColor, true)
healthText.Position = lerp2(barTo, barFrom, self.health / self.maxHealth)
- healthText.TextBounds * 0.5
- HEALTH_TEXT_OFFSET
end
visible.name.Visible = enabled and onScreen and options.name
if visible.name.Visible then
local name = visible.name
name.Size = interface.sharedSettings.textSize
name.Font = interface.sharedSettings.textFont
name.Color = parseColor(self, options.nameColor[1])
name.Transparency = options.nameColor[2]
name.Outline = options.nameOutline
name.OutlineColor = parseColor(self, options.nameOutlineColor, true)
name.Position = (corners.topLeft + corners.topRight) * 0.5 - Vector2.yAxis * name.TextBounds.Y - NAME_OFFSET
end
visible.distance.Visible = enabled and onScreen and self.distance and options.distance
if visible.distance.Visible then
local distance = visible.distance
distance.Text = round(self.distance) .. " studs"
distance.Size = interface.sharedSettings.textSize
distance.Font = interface.sharedSettings.textFont
distance.Color = parseColor(self, options.distanceColor[1])
distance.Transparency = options.distanceColor[2]
distance.Outline = options.distanceOutline
distance.OutlineColor = parseColor(self, options.distanceOutlineColor, true)
distance.Position = (corners.bottomLeft + corners.bottomRight) * 0.5 + DISTANCE_OFFSET
end
visible.weapon.Visible = enabled and onScreen and options.weapon
if visible.weapon.Visible then
local weapon = visible.weapon
weapon.Text = self.weapon
weapon.Size = interface.sharedSettings.textSize
weapon.Font = interface.sharedSettings.textFont
weapon.Color = parseColor(self, options.weaponColor[1])
weapon.Transparency = options.weaponColor[2]
weapon.Outline = options.weaponOutline
weapon.OutlineColor = parseColor(self, options.weaponOutlineColor, true)
weapon.Position = (corners.bottomLeft + corners.bottomRight) * 0.5
+ (
visible.distance.Visible and DISTANCE_OFFSET + Vector2.yAxis * visible.distance.TextBounds.Y
or Vector2.zero
)
end
visible.tracer.Visible = enabled and onScreen and options.tracer
visible.tracerOutline.Visible = visible.tracer.Visible and options.tracerOutline
if visible.tracer.Visible then
local tracer = visible.tracer
tracer.Color = parseColor(self, options.tracerColor[1])
tracer.Transparency = options.tracerColor[2]
tracer.To = (corners.bottomLeft + corners.bottomRight) * 0.5
tracer.From = options.tracerOrigin == "Middle" and viewportSize * 0.5
or options.tracerOrigin == "Top" and viewportSize * Vector2.new(0.5, 0)
or options.tracerOrigin == "Bottom" and viewportSize * Vector2.new(0.5, 1)
local tracerOutline = visible.tracerOutline
tracerOutline.Color = parseColor(self, options.tracerOutlineColor[1], true)
tracerOutline.Transparency = options.tracerOutlineColor[2]
tracerOutline.To = tracer.To
tracerOutline.From = tracer.From
end
hidden.arrow.Visible = enabled and not onScreen and options.offScreenArrow
hidden.arrowOutline.Visible = hidden.arrow.Visible and options.offScreenArrowOutline
if hidden.arrow.Visible and self.direction then
local arrow = hidden.arrow
arrow.PointA = min2(
max2(viewportSize * 0.5 + self.direction * options.offScreenArrowRadius, Vector2.one * 25),
viewportSize - Vector2.one * 25
)
arrow.PointB = arrow.PointA - rotateVector(self.direction, 0.45) * options.offScreenArrowSize
arrow.PointC = arrow.PointA - rotateVector(self.direction, -0.45) * options.offScreenArrowSize
arrow.Color = parseColor(self, options.offScreenArrowColor[1])
arrow.Transparency = options.offScreenArrowColor[2]
local arrowOutline = hidden.arrowOutline
arrowOutline.PointA = arrow.PointA
arrowOutline.PointB = arrow.PointB
arrowOutline.PointC = arrow.PointC
arrowOutline.Color = parseColor(self, options.offScreenArrowOutlineColor[1], true)
arrowOutline.Transparency = options.offScreenArrowOutlineColor[2]
end
local box3dEnabled = enabled and onScreen and options.box3d
for i = 1, #box3d do
local face = box3d[i]
for i2 = 1, #face do
local line = face[i2]
line.Visible = box3dEnabled
line.Color = parseColor(self, options.box3dColor[1])
line.Transparency = options.box3dColor[2]
end
if box3dEnabled then
local line1 = face[1]
line1.From = corners.corners[i]
line1.To = corners.corners[i == 4 and 1 or i + 1]
local line2 = face[2]
line2.From = corners.corners[i == 4 and 1 or i + 1]
line2.To = corners.corners[i == 4 and 5 or i + 5]
local line3 = face[3]
line3.From = corners.corners[i == 4 and 5 or i + 5]
line3.To = corners.corners[i == 4 and 8 or i + 4]
end
end
end
-- cham object
local ChamObject = {}
ChamObject.__index = ChamObject
function ChamObject.new(player, interface)
local self = setmetatable({}, ChamObject)
self.player = assert(player, "Missing argument #1 (Player expected)")
self.interface = assert(interface, "Missing argument #2 (table expected)")
for _, HL in pairs(workspace:GetChildren()) do
if HL:IsA("Highlight") then
HL:Destroy()
end
end
self:Construct()
return self
end
function ChamObject:Construct()
self.highlight = Instance.new("Highlight", container)
self.updateConnection = runService.Heartbeat:Connect(function()
self:Update()
end)
end
function ChamObject:Destruct()
self.updateConnection:Disconnect()
self.highlight:Destroy()
clear(self)
end
function ChamObject:Update()
local highlight = self.highlight
local interface = self.interface
local character = interface.getCharacter(self.player)
local options = interface.teamSettings[interface.isFriendly(self.player) and "friendly" or "enemy"]
local enabled = options.enabled
and character
and not (#interface.whitelist > 0 and not find(interface.whitelist, self.player.UserId))
highlight.Enabled = enabled and options.chams
if highlight.Enabled then
highlight.Adornee = character
highlight.FillColor = parseColor(self, options.chamsFillColor[1])
highlight.FillTransparency = options.chamsFillColor[2]
highlight.OutlineColor = parseColor(self, options.chamsOutlineColor[1], true)
highlight.OutlineTransparency = options.chamsOutlineColor[2]
highlight.DepthMode = options.chamsVisibleOnly and "Occluded" or "AlwaysOnTop"
end
end
-- instance class
local InstanceObject = {}
InstanceObject.__index = InstanceObject
function InstanceObject.new(instance, options)
local self = setmetatable({}, InstanceObject)
self.instance = assert(instance, "Missing argument #1 (Instance Expected)")
self.options = assert(options, "Missing argument #2 (table expected)")
self:Construct()
return self
end
function InstanceObject:Construct()
local options = self.options
options.enabled = options.enabled == nil and true or options.enabled
options.text = options.text or "{name}"
options.textColor = options.textColor or { Color3.new(1, 1, 1), 1 }
options.textOutline = options.textOutline == nil and true or options.textOutline
options.textOutlineColor = options.textOutlineColor or Color3.new()
options.textSize = options.textSize or 13
options.textFont = options.textFont or 2
options.limitDistance = options.limitDistance or false
options.maxDistance = options.maxDistance or 150
self.text = Drawing.new("Text")
self.text.Center = true
self.renderConnection = runService.Heartbeat:Connect(function(deltaTime)
self:Render(deltaTime)
end)
end
function InstanceObject:Destruct()
self.renderConnection:Disconnect()
self.text:Remove()
end
function InstanceObject:Render()
local instance = self.instance
if not instance or not instance.Parent then
return self:Destruct()
end
local text = self.text
local options = self.options
if not options.enabled then
text.Visible = false
return
end
local world = getPivot(instance).Position
local position, visible, depth = worldToScreen(world)
if options.limitDistance and depth > options.maxDistance then
visible = false
end
text.Visible = visible
if text.Visible then
text.Position = position
text.Color = options.textColor[1]
text.Transparency = options.textColor[2]
text.Outline = options.textOutline
text.OutlineColor = options.textOutlineColor
text.Size = options.textSize
text.Font = options.textFont
text.Text = options.text
:gsub("{name}", instance.Name)
:gsub("{distance}", round(depth))
:gsub("{position}", tostring(world))
end
end
-- interface
local EspInterface = {
_hasLoaded = false,
_objectCache = {},
whitelist = {},
sharedSettings = {
textSize = 13,
textFont = 2,
limitDistance = false,
maxDistance = 150,
useTeamColor = false,
},
teamSettings = {
enemy = {
enabled = false,
box = false,
boxColor = { Color3.new(1, 0, 0), 1 },
boxOutline = true,
boxOutlineColor = { Color3.new(), 1 },
boxFill = false,
boxFillColor = { Color3.new(1, 0, 0), 0.5 },
healthBar = false,
healthyColor = Color3.new(0, 1, 0),
dyingColor = Color3.new(1, 0, 0),
healthBarOutline = true,
healthBarOutlineColor = { Color3.new(), 0.5 },
healthText = false,
healthTextColor = { Color3.new(1, 1, 1), 1 },
healthTextOutline = true,
healthTextOutlineColor = Color3.new(),
box3d = false,
box3dColor = { Color3.new(1, 0, 0), 1 },
name = false,
nameColor = { Color3.new(1, 1, 1), 1 },
nameOutline = true,
nameOutlineColor = Color3.new(),
weapon = false,
weaponColor = { Color3.new(1, 1, 1), 1 },
weaponOutline = true,
weaponOutlineColor = Color3.new(),
distance = false,
distanceColor = { Color3.new(1, 1, 1), 1 },
distanceOutline = true,
distanceOutlineColor = Color3.new(),
tracer = false,
tracerOrigin = "Bottom",
tracerColor = { Color3.new(1, 0, 0), 1 },
tracerOutline = true,
tracerOutlineColor = { Color3.new(), 1 },
offScreenArrow = false,
offScreenArrowColor = { Color3.new(1, 1, 1), 1 },
offScreenArrowSize = 15,
offScreenArrowRadius = 150,
offScreenArrowOutline = true,
offScreenArrowOutlineColor = { Color3.new(), 1 },
chams = false,
chamsVisibleOnly = false,
chamsFillColor = { Color3.new(0.2, 0.2, 0.2), 0.5 },
chamsOutlineColor = { Color3.new(1, 0, 0), 0 },
},
friendly = {
enabled = false,
box = false,
boxColor = { Color3.new(0, 1, 0), 1 },
boxOutline = true,
boxOutlineColor = { Color3.new(), 1 },
boxFill = false,
boxFillColor = { Color3.new(0, 1, 0), 0.5 },
healthBar = false,
healthyColor = Color3.new(0, 1, 0),
dyingColor = Color3.new(1, 0, 0),
healthBarOutline = true,
healthBarOutlineColor = { Color3.new(), 0.5 },
healthText = false,
healthTextColor = { Color3.new(1, 1, 1), 1 },
healthTextOutline = true,
healthTextOutlineColor = Color3.new(),
box3d = false,
box3dColor = { Color3.new(0, 1, 0), 1 },
name = false,
nameColor = { Color3.new(1, 1, 1), 1 },
nameOutline = true,
nameOutlineColor = Color3.new(),
weapon = false,
weaponColor = { Color3.new(1, 1, 1), 1 },
weaponOutline = true,
weaponOutlineColor = Color3.new(),
distance = false,
distanceColor = { Color3.new(1, 1, 1), 1 },
distanceOutline = true,
distanceOutlineColor = Color3.new(),
tracer = false,
tracerOrigin = "Bottom",
tracerColor = { Color3.new(0, 1, 0), 1 },
tracerOutline = true,
tracerOutlineColor = { Color3.new(), 1 },
offScreenArrow = false,
offScreenArrowColor = { Color3.new(1, 1, 1), 1 },
offScreenArrowSize = 15,
offScreenArrowRadius = 150,
offScreenArrowOutline = true,
offScreenArrowOutlineColor = { Color3.new(), 1 },
chams = false,
chamsVisibleOnly = false,
chamsFillColor = { Color3.new(0.2, 0.2, 0.2), 0.5 },
chamsOutlineColor = { Color3.new(0, 1, 0), 0 },
},
},
}
function EspInterface.AddInstance(instance, options)
local cache = EspInterface._objectCache
if cache[instance] then
warn("Instance handler already exists.")
else
cache[instance] = { InstanceObject.new(instance, options) }
end
return cache[instance][1]
end
function EspInterface.Load()
assert(not EspInterface._hasLoaded, "Esp has already been loaded.")
local function createObject(player)
EspInterface._objectCache[player] = {
EspObject.new(player, EspInterface),
ChamObject.new(player, EspInterface),
}
end
local function removeObject(player)
local object = EspInterface._objectCache[player]
if object then
for i = 1, #object do
object[i]:Destruct()
end
EspInterface._objectCache[player] = nil
end
end
local plrs = players:GetPlayers()
for i = 2, #plrs do
createObject(plrs[i])
end
EspInterface.playerAdded = players.PlayerAdded:Connect(createObject)
EspInterface.playerRemoving = players.PlayerRemoving:Connect(removeObject)
EspInterface._hasLoaded = true
end
function EspInterface.Unload()
assert(EspInterface._hasLoaded, "Esp has not been loaded yet.")
for index, object in next, EspInterface._objectCache do
for i = 1, #object do
object[i]:Destruct()
end
EspInterface._objectCache[index] = nil
end
EspInterface.playerAdded:Disconnect()
EspInterface.playerRemoving:Disconnect()
EspInterface._hasLoaded = false
end
-- game specific functions
function EspInterface.getWeapon(player)
return "Unknown"
end
function EspInterface.isFriendly(player)
return player.Team and player.Team == localPlayer.Team
end
function EspInterface.getTeamColor(player)
return player.Team and player.Team.TeamColor and player.Team.TeamColor.Color
end
function EspInterface.getCharacter(player)
return player.Character
end
function EspInterface.getHealth(player)
local character = player and EspInterface.getCharacter(player)
local humanoid = character and findFirstChildOfClass(character, "Humanoid")
if humanoid then
return humanoid.Health, humanoid.MaxHealth
end
return 100, 100
end
return EspInterface