This repository was archived by the owner on Sep 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathMain.lua
367 lines (302 loc) · 11.2 KB
/
Main.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
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
--// Preventing Multiple Processes
pcall(function()
getgenv().Aimbot.Functions:Exit()
end)
--// Environment
getgenv().Aimbot = {}
local Environment = getgenv().Aimbot
--// Services
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local HttpService = game:GetService("HttpService")
local TweenService = game:GetService("TweenService")
local StarterGui = game:GetService("StarterGui")
local Players = game:GetService("Players")
local Camera = game:GetService("Workspace").CurrentCamera
--// Variables
local LocalPlayer = Players.LocalPlayer
local Title = "Exunys Developer"
local FileNames = {"Aimbot", "Configuration.json", "Drawing.json"}
local Typing, Running, Animation, RequiredDistance, ServiceConnections = false, false, nil, 2000, {}
--// Support Functions
local mousemoverel = mousemoverel or (Input and Input.MouseMove)
local queueonteleport = queue_on_teleport or syn.queue_on_teleport
--// Script Settings
Environment.Settings = {
SendNotifications = true,
SaveSettings = true, -- Re-execute upon changing
ReloadOnTeleport = true,
Enabled = true,
TeamCheck = false,
AliveCheck = true,
WallCheck = false, -- Laggy
Sensitivity = 0, -- Animation length (in seconds) before fully locking onto target
ThirdPerson = false, -- Uses mousemoverel instead of CFrame to support locking in third person (could be choppy)
ThirdPersonSensitivity = 3, -- Boundary: 0.1 - 5
TriggerKey = "MouseButton2",
Toggle = false,
LockPart = "Head" -- Body part to lock on
}
Environment.FOVSettings = {
Enabled = true,
Visible = true,
Amount = 90,
Color = "255, 255, 255",
LockedColor = "255, 70, 70",
Transparency = 0.5,
Sides = 60,
Thickness = 1,
Filled = false
}
Environment.FOVCircle = Drawing.new("Circle")
Environment.Locked = nil
--// Core Functions
local function Encode(Table)
if Table and type(Table) == "table" then
local EncodedTable = HttpService:JSONEncode(Table)
return EncodedTable
end
end
local function Decode(String)
if String and type(String) == "string" then
local DecodedTable = HttpService:JSONDecode(String)
return DecodedTable
end
end
local function GetColor(Color)
local R = tonumber(string.match(Color, "([%d]+)[%s]*,[%s]*[%d]+[%s]*,[%s]*[%d]+"))
local G = tonumber(string.match(Color, "[%d]+[%s]*,[%s]*([%d]+)[%s]*,[%s]*[%d]+"))
local B = tonumber(string.match(Color, "[%d]+[%s]*,[%s]*[%d]+[%s]*,[%s]*([%d]+)"))
return Color3.fromRGB(R, G, B)
end
local function SendNotification(TitleArg, DescriptionArg, DurationArg)
if Environment.Settings.SendNotifications then
StarterGui:SetCore("SendNotification", {
Title = TitleArg,
Text = DescriptionArg,
Duration = DurationArg
})
end
end
--// Functions
local function SaveSettings()
if Environment.Settings.SaveSettings then
if isfile(Title.."/"..FileNames[1].."/"..FileNames[2]) then
writefile(Title.."/"..FileNames[1].."/"..FileNames[2], Encode(Environment.Settings))
end
if isfile(Title.."/"..FileNames[1].."/"..FileNames[3]) then
writefile(Title.."/"..FileNames[1].."/"..FileNames[3], Encode(Environment.FOVSettings))
end
end
end
local function GetClosestPlayer()
if not Environment.Locked then
if Environment.FOVSettings.Enabled then
RequiredDistance = Environment.FOVSettings.Amount
else
RequiredDistance = 2000
end
for _, v in next, Players:GetPlayers() do
if v ~= LocalPlayer then
if v.Character and v.Character:FindFirstChild(Environment.Settings.LockPart) and v.Character:FindFirstChildOfClass("Humanoid") then
if Environment.Settings.TeamCheck and v.Team == LocalPlayer.Team then continue end
if Environment.Settings.AliveCheck and v.Character:FindFirstChildOfClass("Humanoid").Health <= 0 then continue end
if Environment.Settings.WallCheck and #(Camera:GetPartsObscuringTarget({v.Character[Environment.Settings.LockPart].Position}, v.Character:GetDescendants())) > 0 then continue end
local Vector, OnScreen = Camera:WorldToViewportPoint(v.Character[Environment.Settings.LockPart].Position)
local Distance = (Vector2.new(UserInputService:GetMouseLocation().X, UserInputService:GetMouseLocation().Y) - Vector2.new(Vector.X, Vector.Y)).Magnitude
if Distance < RequiredDistance and OnScreen then
RequiredDistance = Distance
Environment.Locked = v
end
end
end
end
elseif (Vector2.new(UserInputService:GetMouseLocation().X, UserInputService:GetMouseLocation().Y) - Vector2.new(Camera:WorldToViewportPoint(Environment.Locked.Character[Environment.Settings.LockPart].Position).X, Camera:WorldToViewportPoint(Environment.Locked.Character[Environment.Settings.LockPart].Position).Y)).Magnitude > RequiredDistance then
Environment.Locked = nil
Animation:Cancel()
Environment.FOVCircle.Color = GetColor(Environment.FOVSettings.Color)
end
end
--// Typing Check
ServiceConnections.TypingStartedConnection = UserInputService.TextBoxFocused:Connect(function()
Typing = true
end)
ServiceConnections.TypingEndedConnection = UserInputService.TextBoxFocusReleased:Connect(function()
Typing = false
end)
--// Create, Save & Load Settings
if Environment.Settings.SaveSettings then
if not isfolder(Title) then
makefolder(Title)
end
if not isfolder(Title.."/"..FileNames[1]) then
makefolder(Title.."/"..FileNames[1])
end
if not isfile(Title.."/"..FileNames[1].."/"..FileNames[2]) then
writefile(Title.."/"..FileNames[1].."/"..FileNames[2], Encode(Environment.Settings))
else
Environment.Settings = Decode(readfile(Title.."/"..FileNames[1].."/"..FileNames[2]))
end
if not isfile(Title.."/"..FileNames[1].."/"..FileNames[3]) then
writefile(Title.."/"..FileNames[1].."/"..FileNames[3], Encode(Environment.FOVSettings))
else
Environment.Visuals = Decode(readfile(Title.."/"..FileNames[1].."/"..FileNames[3]))
end
coroutine.wrap(function()
while wait(10) and Environment.Settings.SaveSettings do
SaveSettings()
end
end)()
else
if isfolder(Title) then
delfolder(Title)
end
end
local function Load()
ServiceConnections.RenderSteppedConnection = RunService.RenderStepped:Connect(function()
if Environment.FOVSettings.Enabled and Environment.Settings.Enabled then
Environment.FOVCircle.Radius = Environment.FOVSettings.Amount
Environment.FOVCircle.Thickness = Environment.FOVSettings.Thickness
Environment.FOVCircle.Filled = Environment.FOVSettings.Filled
Environment.FOVCircle.NumSides = Environment.FOVSettings.Sides
Environment.FOVCircle.Color = GetColor(Environment.FOVSettings.Color)
Environment.FOVCircle.Transparency = Environment.FOVSettings.Transparency
Environment.FOVCircle.Visible = Environment.FOVSettings.Visible
Environment.FOVCircle.Position = Vector2.new(UserInputService:GetMouseLocation().X, UserInputService:GetMouseLocation().Y)
else
Environment.FOVCircle.Visible = false
end
if Running and Environment.Settings.Enabled then
GetClosestPlayer()
if Environment.Settings.ThirdPerson then
Environment.Settings.ThirdPersonSensitivity = math.clamp(Environment.Settings.ThirdPersonSensitivity, 0.1, 5)
local Vector = Camera:WorldToViewportPoint(Environment.Locked.Character[Environment.Settings.LockPart].Position)
mousemoverel((Vector.X - UserInputService:GetMouseLocation().X) * Environment.Settings.ThirdPersonSensitivity, (Vector.Y - UserInputService:GetMouseLocation().Y) * Environment.Settings.ThirdPersonSensitivity)
else
if Environment.Settings.Sensitivity > 0 then
Animation = TweenService:Create(Camera, TweenInfo.new(Environment.Settings.Sensitivity, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {CFrame = CFrame.new(Camera.CFrame.Position, Environment.Locked.Character[Environment.Settings.LockPart].Position)})
Animation:Play()
else
Camera.CFrame = CFrame.new(Camera.CFrame.Position, Environment.Locked.Character[Environment.Settings.LockPart].Position)
end
end
Environment.FOVCircle.Color = GetColor(Environment.FOVSettings.LockedColor)
end
end)
ServiceConnections.InputBeganConnection = UserInputService.InputBegan:Connect(function(Input)
if not Typing then
pcall(function()
if Input.KeyCode == Enum.KeyCode[Environment.Settings.TriggerKey] then
if Environment.Settings.Toggle then
Running = not Running
if not Running then
Environment.Locked = nil
Animation:Cancel()
Environment.FOVCircle.Color = GetColor(Environment.FOVSettings.Color)
end
else
Running = true
end
end
end)
pcall(function()
if Input.UserInputType == Enum.UserInputType[Environment.Settings.TriggerKey] then
if Environment.Settings.Toggle then
Running = not Running
if not Running then
Environment.Locked = nil
Animation:Cancel()
Environment.FOVCircle.Color = GetColor(Environment.FOVSettings.Color)
end
else
Running = true
end
end
end)
end
end)
ServiceConnections.InputEndedConnection = UserInputService.InputEnded:Connect(function(Input)
if not Typing then
pcall(function()
if Input.KeyCode == Enum.KeyCode[Environment.Settings.TriggerKey] then
if not Environment.Settings.Toggle then
Running = false
Environment.Locked = nil
Animation:Cancel()
Environment.FOVCircle.Color = GetColor(Environment.FOVSettings.Color)
end
end
end)
pcall(function()
if Input.UserInputType == Enum.UserInputType[Environment.Settings.TriggerKey] then
if not Environment.Settings.Toggle then
Running = false
Environment.Locked = nil
Animation:Cancel()
Environment.FOVCircle.Color = GetColor(Environment.FOVSettings.Color)
end
end
end)
end
end)
end
--// Functions
Environment.Functions = {}
function Environment.Functions:Exit()
SaveSettings()
for _, v in next, ServiceConnections do
v:Disconnect()
end
if Environment.FOVCircle.Remove then Environment.FOVCircle:Remove() end
getgenv().Aimbot.Functions = nil
getgenv().Aimbot = nil
end
function Environment.Functions:Restart()
SaveSettings()
for _, v in next, ServiceConnections do
v:Disconnect()
end
Load()
end
function Environment.Functions:ResetSettings()
Environment.Settings = {
SendNotifications = true,
SaveSettings = true, -- Re-execute upon changing
ReloadOnTeleport = true,
Enabled = true,
TeamCheck = false,
AliveCheck = true,
WallCheck = false,
Sensitivity = 0, -- Animation length (in seconds) before fully locking onto target
ThirdPerson = false,
ThirdPersonSensitivity = 3,
TriggerKey = "MouseButton2",
Toggle = false,
LockPart = "Head" -- Body part to lock on
}
Environment.FOVSettings = {
Enabled = true,
Visible = true,
Amount = 90,
Color = "255, 255, 255",
LockedColor = "255, 70, 70",
Transparency = 0.5,
Sides = 60,
Thickness = 1,
Filled = false
}
end
--// Support Check
if not Drawing or not getgenv then
SendNotification(Title, "Your exploit does not support this script", 3); return
end
--// Reload On Teleport
if Environment.Settings.ReloadOnTeleport then
if queueonteleport then
queueonteleport(game:HttpGet("https://raw.githubusercontent.com/Exunys/Aimbot-V2/main/Resources/Scripts/Main.lua"))
else
SendNotification(Title, "Your exploit does not support \"syn.queue_on_teleport()\"")
end
end
--// Load
Load(); SendNotification(Title, "Aimbot script successfully loaded! Check the GitHub page on how to configure the script.", 5)