-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsource.lua
More file actions
422 lines (363 loc) · 12.7 KB
/
source.lua
File metadata and controls
422 lines (363 loc) · 12.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
-- custom version of ui lib
local ui = loadstring(game:HttpGet("https://raw.githubusercontent.com/kitodoescode/Bracket/main/BracketV34.lua"))()
-- game objects/services
local players = game:GetService("Players")
local runservice = game:GetService("RunService")
local camera = workspace.CurrentCamera
-- our globals vars
_G.esp_enabled = true
-- our local vars
local esp_objects = {}
local date = os.date("%d-%m-%y")
local last
local lp = players.LocalPlayer
local lp_char = lp.Character
local bone_connections_r6 = {
{"Head", "Torso"},
{"Torso", "Right Arm"},
{"Torso", "Left Arm"},
{"Torso", "Right Leg"},
{"Torso", "Left Leg"}
}
local bone_connections_r15 = {
{"Head", "UpperTorso"},
{"UpperTorso", "LowerTorso"},
{"LowerTorso", "LeftUpperLeg"},
{"LowerTorso", "RightUpperLeg"},
{"LeftUpperLeg", "LeftLowerLeg"},
{"LeftLowerLeg", "LeftFoot"},
{"RightUpperLeg", "RightLowerLeg"},
{"RightLowerLeg", "RightFoot"},
{"UpperTorso", "LeftUpperArm"},
{"UpperTorso", "RightUpperArm"},
{"LeftUpperArm", "LeftLowerArm"},
{"LeftLowerArm", "LeftHand"},
{"RightUpperArm", "RightLowerArm"},
{"RightLowerArm", "RightHand"}
}
local all_bones_r6 = {
"Head",
"Torso",
"Right Arm",
"Left Arm",
"Right Leg",
"Left Leg"
}
local all_bones_r15 = {
"Head",
"UpperTorso",
"LowerTorso",
"RightUpperLeg",
"LeftUpperLeg",
"RightLowerLeg",
"LeftLowerLeg",
"RightFoot",
"LeftFoot",
"RightUpperArm",
"LeftUpperArm",
"RightLowerArm",
"LeftLowerArm",
"RightHand",
"LeftHand"
}
local window = ui:Window({Name = "eternal | @kitodoescode"})
do
local watermark =
window:Watermark(
{
Title = "eternal | @kitodoescode | " .. date,
Enabled = true,
Fixed = true -- custom
}
)
last = tick()
runservice.Heartbeat:Connect(
function()
-- update date ( checking every one second )
local curr = tick()
if curr - last >= 1 then
date = os.date("%d-%m-%y")
watermark.Title = "eternal | @kitodoescode | " .. date
end
end
)
end
-- helper for drawing objects
local function draw(type, options)
local obj = Drawing.new(type)
for n, v in pairs(options) do
obj[n] = v
end
return obj
end
-- helper for w2s obv
local function world_to_screen(world)
return camera:WorldToViewportPoint(world)
end
-- function to add esp objects and connections on a player
local function add_player_esp(player)
if esp_objects[player] then
return
end
local box =
draw(
"Square",
{
Visible = false,
Color = Color3.new(1, 1, 1),
Size = Vector2.new(0, 0),
Thickness = 1,
ZIndex = 20
}
)
local box_outline =
draw(
"Square",
{
Visible = false,
Color = Color3.new(0, 0, 0),
Size = Vector2.new(0, 0),
Thickness = 3
}
)
local name =
draw(
"Text",
{
Visible = false,
Color = Color3.new(1, 1, 1),
Text = player.Name,
Center = true,
Outline = true,
OutlineColor = Color3.new(0, 0, 0)
}
)
local distance =
draw(
"Text",
{
Visible = false,
Color = Color3.new(1, 1, 1),
Text = "[ 0.0m ]",
Center = true,
Outline = true,
OutlineColor = Color3.new(0, 0, 0)
}
)
local skeleton = {lines = {}, joints = {}, bone_connections = nil, bone_set = nil, rig_detected = false}
local objects = {box = box, box_outline = box_outline, name = name, distance = distance, skeleton = skeleton}
local function hide_esp_objects()
objects.box.Visible = false
objects.box_outline.Visible = false
objects.name.Visible = false
objects.distance.Visible = false
for _, bone_table in ipairs(objects.skeleton.lines) do
bone_table.joint.Visible = false
bone_table.joint_outline.Visible = false
end
for _, joint_table in ipairs(objects.skeleton.joints) do
joint_table.dot.Visible = false
joint_table.outline.Visible = false
end
end
local connection =
runservice.RenderStepped:Connect(
function()
local char = player.Character
if not char then
hide_esp_objects()
return
end
local hrp = char:FindFirstChild("HumanoidRootPart")
local head = char:FindFirstChild("Head")
if not hrp or not head then
hide_esp_objects()
return
end
if not objects.skeleton.rig_detected then
local humanoid = char:FindFirstChild("Humanoid")
if humanoid.RigType == Enum.HumanoidRigType.R6 then
objects.skeleton.bone_connections = bone_connections_r6
objects.skeleton.bone_set = all_bones_r6
else
objects.skeleton.bone_connections = bone_connections_r15
objects.skeleton.bone_set = all_bones_r15
end
objects.skeleton.rig_detected = true
for idx, bone_joint in pairs(objects.skeleton.bone_connections) do
local from_bone, to_bone = bone_joint[1], bone_joint[2]
local joint =
draw(
"Line",
{
Visible = false,
Color = Color3.new(1, 1, 1),
Thickness = 1,
ZIndex = 2
}
)
local joint_outline =
draw(
"Line",
{
Visible = false,
Color = Color3.new(0, 0, 0),
Thickness = 3
}
)
objects.skeleton.lines[idx] = {
joint = joint,
joint_outline = joint_outline,
from_bone = from_bone,
to_bone = to_bone
}
end
for _, bone_name in pairs(objects.skeleton.bone_set) do
local dot =
draw(
"Circle",
{
Visible = false,
Color = Color3.new(1, 1, 1),
Thickness = 1,
Radius = 2,
Filled = true,
ZIndex = 4
}
)
local outline =
draw(
"Circle",
{
Visible = false,
Color = Color3.new(0, 0, 0),
Radius = 3,
Filled = true,
ZIndex = 3
}
)
table.insert(objects.skeleton.joints, {dot = dot, outline = outline, bone = bone_name})
end
end
local _, visible = world_to_screen(hrp.Position)
if not visible then
hide_esp_objects()
return
end
local head_pos, _ = world_to_screen(head.Position + Vector3.new(0, 0.5, 0))
local hrp_pos, _ = world_to_screen(hrp.Position - Vector3.new(0, 3, 0))
local w = math.abs(head_pos.y - hrp_pos.y) * 1.05
local h = math.abs(head_pos.y - hrp_pos.y) * 1.25
local top_left = Vector2.new(head_pos.x - (w / 2), hrp_pos.y - (h * 0.925))
objects.box.Size = Vector2.new(w, h)
objects.box.Position = top_left
objects.box.Visible = true
objects.box_outline.Size = Vector2.new(w, h)
objects.box_outline.Position = top_left
objects.box_outline.Visible = true
local top_center = Vector2.new(head_pos.x, top_left.y - 20)
objects.name.Position = top_center
objects.name.Visible = true
local bottom_center = Vector2.new(head_pos.x, top_left.y + h + 10)
local our_pos
if not lp_char:FindFirstChild("HumanoidRootPart") then
our_pos = workspace.CurrentCamera.CFrame.Position
else
our_pos = lp_char.HumanoidRootPart.Position
end
objects.distance.Text = string.format("[ %.1fm ]", (our_pos - hrp.Position).Magnitude)
objects.distance.Position = bottom_center
objects.distance.Visible = true
if objects.skeleton.rig_detected then
for _, bone_table in ipairs(objects.skeleton.lines) do
local from_bone, to_bone =
char:FindFirstChild(bone_table.from_bone),
char:FindFirstChild(bone_table.to_bone)
if not from_bone or not to_bone then
bone_table.joint.Visible = false
bone_table.joint_outline.Visible = false
return
end
local from_pos, from_visibility = world_to_screen(from_bone.Position)
local to_pos, to_visibility = world_to_screen(to_bone.Position)
if not from_visibility or not to_visibility then
bone_table.joint.Visible = false
bone_table.joint_outline.Visible = false
return
end
bone_table.joint.From = Vector2.new(from_pos.x, from_pos.y)
bone_table.joint.To = Vector2.new(to_pos.x, to_pos.y)
bone_table.joint.Visible = true
bone_table.joint_outline.From = Vector2.new(from_pos.x, from_pos.y)
bone_table.joint_outline.To = Vector2.new(to_pos.x, to_pos.y)
bone_table.joint_outline.Visible = true
end
for _, joint_table in ipairs(objects.skeleton.joints) do
local bone = char:FindFirstChild(joint_table.bone)
if not bone then
joint_table.dot.Visible = false
joint_table.outline.Visiblie = false
end
local bone_pos, bone_visibility = world_to_screen(bone.Position)
if not bone_visibility then
joint_table.dot.Visible = false
joint_table.outline.Visible = false
end
joint_table.dot.Position = Vector2.new(bone_pos.x, bone_pos.y)
joint_table.dot.Visible = true
joint_table.outline.Position = Vector2.new(bone_pos.x, bone_pos.y)
joint_table.outline.Visible = true
end
end
end
)
local connections = {connection}
esp_objects[player] = {objects = objects, connections = connections}
end
-- function to remove esp objects and connections from player
local function remove_player_esp(player)
local player_table = esp_objects[player]
if not player_table then
return
end
for _, connection in pairs(player_table.connections) do
if connection.Connected then
connection:Disconnect()
end
end
for name, draw_object in pairs(player_table.objects) do
if name == "skeleton" then
for _, b in ipairs(player_table.objects.skeleton.lines) do
b.joint:Destroy()
b.joint_outline:Destroy()
end
for _, b in ipairs(player_table.objects.skeleton.joints) do
b.dot:Destroy()
b.outline:Destroy()
end
else
draw_object:Destroy()
end
end
player_table = nil
end
-- adding esp objects and connections on all current player
for _, p in pairs(players:GetPlayers()) do
add_player_esp(p)
end
-- add esp objects and connections on any new player that joined
players.PlayerAdded:Connect(
function(player)
player.CharacterAdded:Connect(
function()
add_player_esp(player)
end
)
end
)
-- remove esp objects and connections from any new player that left
players.PlayerRemoving:Connect(
function(player)
remove_player_esp(player)
end
)