-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAimbot.lua
More file actions
401 lines (295 loc) · 12.8 KB
/
Aimbot.lua
File metadata and controls
401 lines (295 loc) · 12.8 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
--[[
Universal Aimbot Module by Exunys © CC0 1.0 Universal (2023 - 2024)
https://github.com/Exunys
]]
--// Cache
local game, workspace = game, workspace
local getrawmetatable, getmetatable, setmetatable, pcall, getgenv, next, tick = getrawmetatable, getmetatable, setmetatable, pcall, getgenv, next, tick
local Vector2new, Vector3zero, CFramenew, Color3fromRGB, Color3fromHSV, Drawingnew, TweenInfonew = Vector2.new, Vector3.zero, CFrame.new, Color3.fromRGB, Color3.fromHSV, Drawing.new, TweenInfo.new
local getupvalue, mousemoverel, tablefind, tableremove, stringlower, stringsub, mathclamp = debug.getupvalue, mousemoverel or (Input and Input.MouseMove), table.find, table.remove, string.lower, string.sub, math.clamp
local GameMetatable = getrawmetatable and getrawmetatable(game) or {
-- Auxillary functions - if the executor doesn't support "getrawmetatable".
__index = function(self, Index)
return self[Index]
end,
__newindex = function(self, Index, Value)
self[Index] = Value
end
}
local __index = GameMetatable.__index
local __newindex = GameMetatable.__newindex
local getrenderproperty, setrenderproperty = getrenderproperty or __index, setrenderproperty or __newindex
local GetService = __index(game, "GetService")
--// Services
local RunService = GetService(game, "RunService")
local UserInputService = GetService(game, "UserInputService")
local TweenService = GetService(game, "TweenService")
local Players = GetService(game, "Players")
--// Service Methods
local LocalPlayer = __index(Players, "LocalPlayer")
local Camera = __index(workspace, "CurrentCamera")
local FindFirstChild, FindFirstChildOfClass = __index(game, "FindFirstChild"), __index(game, "FindFirstChildOfClass")
local GetDescendants = __index(game, "GetDescendants")
local WorldToViewportPoint = __index(Camera, "WorldToViewportPoint")
local GetPartsObscuringTarget = __index(Camera, "GetPartsObscuringTarget")
local GetMouseLocation = __index(UserInputService, "GetMouseLocation")
local GetPlayers = __index(Players, "GetPlayers")
--// Variables
local RequiredDistance, Typing, Running, ServiceConnections, Animation, OriginalSensitivity = 2000, false, false, {}
local Connect, Disconnect = __index(game, "DescendantAdded").Connect
--[[
local Degrade = false
do
xpcall(function()
local TemporaryDrawing = Drawingnew("Line")
getrenderproperty = getupvalue(getmetatable(TemporaryDrawing).__index, 4)
setrenderproperty = getupvalue(getmetatable(TemporaryDrawing).__newindex, 4)
TemporaryDrawing.Remove(TemporaryDrawing)
end, function()
Degrade, getrenderproperty, setrenderproperty = true, function(Object, Key)
return Object[Key]
end, function(Object, Key, Value)
Object[Key] = Value
end
end)
local TemporaryConnection = Connect(__index(game, "DescendantAdded"), function() end)
Disconnect = TemporaryConnection.Disconnect
Disconnect(TemporaryConnection)
end
]]
--// Checking for multiple processes
if ExunysDeveloperAimbot and ExunysDeveloperAimbot.Exit then
ExunysDeveloperAimbot:Exit()
end
--// Environment
getgenv().ExunysDeveloperAimbot = {
DeveloperSettings = {
UpdateMode = "RenderStepped",
TeamCheckOption = "TeamColor",
RainbowSpeed = 1 -- Bigger = Slower
},
Settings = {
Enabled = true,
TeamCheck = false,
AliveCheck = true,
WallCheck = false,
OffsetToMoveDirection = false,
OffsetIncrement = 15,
Sensitivity = 0, -- Animation length (in seconds) before fully locking onto target
Sensitivity2 = 3.5, -- mousemoverel Sensitivity
LockMode = 1, -- 1 = CFrame; 2 = mousemoverel
LockPart = "Head", -- Body part to lock on
TriggerKey = Enum.UserInputType.MouseButton2,
Toggle = false
},
FOVSettings = {
Enabled = true,
Visible = true,
Radius = 90,
NumSides = 60,
Thickness = 1,
Transparency = 1,
Filled = false,
RainbowColor = false,
RainbowOutlineColor = false,
Color = Color3fromRGB(255, 255, 255),
OutlineColor = Color3fromRGB(0, 0, 0),
LockedColor = Color3fromRGB(255, 150, 150)
},
Blacklisted = {},
FOVCircleOutline = Drawingnew("Circle"),
FOVCircle = Drawingnew("Circle")
}
local Environment = getgenv().ExunysDeveloperAimbot
setrenderproperty(Environment.FOVCircle, "Visible", false)
setrenderproperty(Environment.FOVCircleOutline, "Visible", false)
--// Core Functions
local FixUsername = function(String)
local Result
for _, Value in next, GetPlayers(Players) do
local Name = __index(Value, "Name")
if stringsub(stringlower(Name), 1, #String) == stringlower(String) then
Result = Name
end
end
return Result
end
local GetRainbowColor = function()
local RainbowSpeed = Environment.DeveloperSettings.RainbowSpeed
return Color3fromHSV(tick() % RainbowSpeed / RainbowSpeed, 1, 1)
end
local ConvertVector = function(Vector)
return Vector2new(Vector.X, Vector.Y)
end
local CancelLock = function()
Environment.Locked = nil
local FOVCircle = Environment.FOVCircle--Degrade and Environment.FOVCircle or Environment.FOVCircle.__OBJECT
setrenderproperty(FOVCircle, "Color", Environment.FOVSettings.Color)
__newindex(UserInputService, "MouseDeltaSensitivity", OriginalSensitivity)
if Animation then
Animation:Cancel()
end
end
local GetClosestPlayer = function()
local Settings = Environment.Settings
local LockPart = Settings.LockPart
if not Environment.Locked then
RequiredDistance = Environment.FOVSettings.Enabled and Environment.FOVSettings.Radius or 2000
for _, Value in next, GetPlayers(Players) do
local Character = __index(Value, "Character")
local Humanoid = Character and FindFirstChildOfClass(Character, "Humanoid")
if Value ~= LocalPlayer and not tablefind(Environment.Blacklisted, __index(Value, "Name")) and Character and FindFirstChild(Character, LockPart) and Humanoid then
local PartPosition, TeamCheckOption = __index(Character[LockPart], "Position"), Environment.DeveloperSettings.TeamCheckOption
if Settings.TeamCheck and __index(Value, TeamCheckOption) == __index(LocalPlayer, TeamCheckOption) then
continue
end
if Settings.AliveCheck and __index(Humanoid, "Health") <= 0 then
continue
end
if Settings.WallCheck then
local BlacklistTable = GetDescendants(__index(LocalPlayer, "Character"))
for _, Value in next, GetDescendants(Character) do
BlacklistTable[#BlacklistTable + 1] = Value
end
if #GetPartsObscuringTarget(Camera, {PartPosition}, BlacklistTable) > 0 then
continue
end
end
local Vector, OnScreen, Distance = WorldToViewportPoint(Camera, PartPosition)
Vector = ConvertVector(Vector)
Distance = (GetMouseLocation(UserInputService) - Vector).Magnitude
if Distance < RequiredDistance and OnScreen then
RequiredDistance, Environment.Locked = Distance, Value
end
end
end
elseif (GetMouseLocation(UserInputService) - ConvertVector(WorldToViewportPoint(Camera, __index(__index(__index(Environment.Locked, "Character"), LockPart), "Position")))).Magnitude > RequiredDistance then
CancelLock()
end
end
local Load = function()
OriginalSensitivity = __index(UserInputService, "MouseDeltaSensitivity")
local Settings, FOVCircle, FOVCircleOutline, FOVSettings, Offset = Environment.Settings, Environment.FOVCircle, Environment.FOVCircleOutline, Environment.FOVSettings
--[[
if not Degrade then
FOVCircle, FOVCircleOutline = FOVCircle.__OBJECT, FOVCircleOutline.__OBJECT
end
]]
ServiceConnections.RenderSteppedConnection = Connect(__index(RunService, Environment.DeveloperSettings.UpdateMode), function()
local OffsetToMoveDirection, LockPart = Settings.OffsetToMoveDirection, Settings.LockPart
if FOVSettings.Enabled and Settings.Enabled then
for Index, Value in next, FOVSettings do
if Index == "Color" then
continue
end
if pcall(getrenderproperty, FOVCircle, Index) then
setrenderproperty(FOVCircle, Index, Value)
setrenderproperty(FOVCircleOutline, Index, Value)
end
end
setrenderproperty(FOVCircle, "Color", (Environment.Locked and FOVSettings.LockedColor) or FOVSettings.RainbowColor and GetRainbowColor() or FOVSettings.Color)
setrenderproperty(FOVCircleOutline, "Color", FOVSettings.RainbowOutlineColor and GetRainbowColor() or FOVSettings.OutlineColor)
setrenderproperty(FOVCircleOutline, "Thickness", FOVSettings.Thickness + 1)
setrenderproperty(FOVCircle, "Position", GetMouseLocation(UserInputService))
setrenderproperty(FOVCircleOutline, "Position", GetMouseLocation(UserInputService))
else
setrenderproperty(FOVCircle, "Visible", false)
setrenderproperty(FOVCircleOutline, "Visible", false)
end
if Running and Settings.Enabled then
GetClosestPlayer()
Offset = OffsetToMoveDirection and __index(FindFirstChildOfClass(__index(Environment.Locked, "Character"), "Humanoid"), "MoveDirection") * (mathclamp(Settings.OffsetIncrement, 1, 30) / 10) or Vector3zero
if Environment.Locked then
local LockedPosition_Vector3 = __index(__index(Environment.Locked, "Character")[LockPart], "Position")
local LockedPosition = WorldToViewportPoint(Camera, LockedPosition_Vector3 + Offset)
if Environment.Settings.LockMode == 2 then
mousemoverel((LockedPosition.X - GetMouseLocation(UserInputService).X) / Settings.Sensitivity2, (LockedPosition.Y - GetMouseLocation(UserInputService).Y) / Settings.Sensitivity2)
else
if Settings.Sensitivity > 0 then
Animation = TweenService:Create(Camera, TweenInfonew(Environment.Settings.Sensitivity, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {CFrame = CFramenew(Camera.CFrame.Position, LockedPosition_Vector3)})
Animation:Play()
else
__newindex(Camera, "CFrame", CFramenew(Camera.CFrame.Position, LockedPosition_Vector3 + Offset))
end
__newindex(UserInputService, "MouseDeltaSensitivity", 0)
end
setrenderproperty(FOVCircle, "Color", FOVSettings.LockedColor)
end
end
end)
ServiceConnections.InputBeganConnection = Connect(__index(UserInputService, "InputBegan"), function(Input)
local TriggerKey, Toggle = Settings.TriggerKey, Settings.Toggle
if Typing then
return
end
if Input.UserInputType == Enum.UserInputType.Keyboard and Input.KeyCode == TriggerKey or Input.UserInputType == TriggerKey then
if Toggle then
Running = not Running
if not Running then
CancelLock()
end
else
Running = true
end
end
end)
ServiceConnections.InputEndedConnection = Connect(__index(UserInputService, "InputEnded"), function(Input)
local TriggerKey, Toggle = Settings.TriggerKey, Settings.Toggle
if Toggle or Typing then
return
end
if Input.UserInputType == Enum.UserInputType.Keyboard and Input.KeyCode == TriggerKey or Input.UserInputType == TriggerKey then
Running = false
CancelLock()
end
end)
end
--// Typing Check
ServiceConnections.TypingStartedConnection = Connect(__index(UserInputService, "TextBoxFocused"), function()
Typing = true
end)
ServiceConnections.TypingEndedConnection = Connect(__index(UserInputService, "TextBoxFocusReleased"), function()
Typing = false
end)
--// Functions
function Environment.Exit(self) -- METHOD | ExunysDeveloperAimbot:Exit(<void>)
assert(self, "EXUNYS_AIMBOT-V3.Exit: Missing parameter #1 \"self\" <table>.")
for Index, _ in next, ServiceConnections do
Disconnect(ServiceConnections[Index])
end
Load = nil; ConvertVector = nil; CancelLock = nil; GetClosestPlayer = nil; GetRainbowColor = nil; FixUsername = nil
self.FOVCircle:Remove()
self.FOVCircleOutline:Remove()
getgenv().ExunysDeveloperAimbot = nil
end
function Environment.Restart() -- ExunysDeveloperAimbot.Restart(<void>)
for Index, _ in next, ServiceConnections do
Disconnect(ServiceConnections[Index])
end
Load()
end
function Environment.Blacklist(self, Username) -- METHOD | ExunysDeveloperAimbot:Blacklist(<string> Player Name)
assert(self, "EXUNYS_AIMBOT-V3.Blacklist: Missing parameter #1 \"self\" <table>.")
assert(Username, "EXUNYS_AIMBOT-V3.Blacklist: Missing parameter #2 \"Username\" <string>.")
Username = FixUsername(Username)
assert(self, "EXUNYS_AIMBOT-V3.Blacklist: User "..Username.." couldn't be found.")
self.Blacklisted[#self.Blacklisted + 1] = Username
end
function Environment.Whitelist(self, Username) -- METHOD | ExunysDeveloperAimbot:Whitelist(<string> Player Name)
assert(self, "EXUNYS_AIMBOT-V3.Whitelist: Missing parameter #1 \"self\" <table>.")
assert(Username, "EXUNYS_AIMBOT-V3.Whitelist: Missing parameter #2 \"Username\" <string>.")
Username = FixUsername(Username)
assert(Username, "EXUNYS_AIMBOT-V3.Whitelist: User "..Username.." couldn't be found.")
local Index = tablefind(self.Blacklisted, Username)
assert(Index, "EXUNYS_AIMBOT-V3.Whitelist: User "..Username.." is not blacklisted.")
tableremove(self.Blacklisted, Index)
end
function Environment.GetClosestPlayer() -- ExunysDeveloperAimbot.GetClosestPlayer(<void>)
GetClosestPlayer()
local Value = Environment.Locked
CancelLock()
return Value
end
Environment.Load = Load -- ExunysDeveloperAimbot.Load()
setmetatable(Environment, {__call = Load})
return Environment