-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAimbot.lua
314 lines (238 loc) · 9.88 KB
/
Aimbot.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
-- // Aimbot
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 {
__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")
local RunService = GetService(game, "RunService")
local UserInputService = GetService(game, "UserInputService")
local TweenService = GetService(game, "TweenService")
local Players = GetService(game, "Players")
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")
local RequiredDistance, Typing, Running, ServiceConnections, Animation, OriginalSensitivity = 2000, false, false, {}
local Connect, Disconnect = __index(game, "DescendantAdded").Connect
getgenv().xova_aimbot = {
DeveloperSettings = {
UpdateMode = "RenderStepped",
TeamCheckOption = "TeamColor",
RainbowSpeed = 1
},
Settings = {
Enabled = true,
TeamCheck = false,
AliveCheck = true,
WallCheck = false,
OffsetToMoveDirection = false,
OffsetIncrement = 15,
Sensitivity = 0,
Sensitivity2 = 3.5,
LockPart = "Head",
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().xova_aimbot
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
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
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)
mousemoverel((LockedPosition.X - GetMouseLocation(UserInputService).X) / Settings.Sensitivity2, (LockedPosition.Y - GetMouseLocation(UserInputService).Y) / Settings.Sensitivity2)
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)
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()
for Index, _ in next, ServiceConnections do
Disconnect(ServiceConnections[Index])
end
Load()
end
function Environment.Blacklist(self, Username)
Username = FixUsername(Username)
self.Blacklisted[#self.Blacklisted + 1] = Username
end
function Environment.Whitelist(self, Username)
Username = FixUsername(Username)
local Index = tablefind(self.Blacklisted, Username)
tableremove(self.Blacklisted, Index)
end
function Environment.GetClosestPlayer()
GetClosestPlayer()
local Value = Environment.Locked
CancelLock()
return Value
end
Environment.Load = Load
setmetatable(Environment, {__call = Load})
return Environment