1 | --]] |
2 | |
3 | --dont mess with he settings unless u know what ur doing |
4 | |
5 | local Settings = { |
6 | rewrittenmain = { |
7 | Enabled = true, |
8 | Key = "q", |
9 | DOT = true, |
10 | AIRSHOT = true, |
11 | NOTIF = true, |
12 | AUTOPRED = false, |
13 | FOV = math.huge, |
14 | RESOVLER = false |
15 | } |
16 | } |
17 | |
18 | local SelectedPart = "UpperTorso" |
19 | local Prediction = true |
20 | local PredictionValue = 0.1259910 |
21 | |
22 | |
23 | local AnchorCount = 0 |
24 | local MaxAnchor = 50 |
25 | |
26 | local CC = game:GetService"Workspace".CurrentCamera |
27 | local Plr; |
28 | local enabled = false |
29 | local accomidationfactor = 0.12348 |
30 | local mouse = game.Players.LocalPlayer:GetMouse() |
31 | local placemarker = Instance.new("Part", game.Workspace) |
32 | |
33 | function makemarker(Parent, Adornee, Color, Size, Size2) |
34 | local e = Instance.new("BillboardGui", Parent) |
35 | e.Name = "PP" |
36 | e.Adornee = Adornee |
37 | e.Size = UDim2.new(Size, Size2, Size, Size2) |
38 | e.AlwaysOnTop = Settings.rewrittenmain.DOT |
39 | local a = Instance.new("Frame", e) |
40 | if Settings.rewrittenmain.DOT == true then |
41 | a.Size = UDim2.new(2, 2, 2) |
42 | else |
43 | a.Size = UDim2.new(0, 0, 0, 0) |
44 | end |
45 | if Settings.rewrittenmain.DOT == true then |
46 | a.Transparency = 0 |
47 | a.BackgroundTransparency = 0 |
48 | else |
49 | a.Transparency = 1 |
50 | a.BackgroundTransparency = 1 |
51 | end |
52 | a.BackgroundColor3 = Color |
53 | local g = Instance.new("UICorner", a) |
54 | if Settings.rewrittenmain.DOT == false then |
55 | g.CornerRadius = UDim.new(0, 0) |
56 | else |
57 | g.CornerRadius = UDim.new(1, 1) |
58 | end |
59 | return(e) |
60 | end |
61 | |
62 | |
63 | local data = game.Players:GetPlayers() |
64 | function noob(player) |
65 | local character |
66 | repeat wait() until player.Character |
67 | local handler = makemarker(guimain, player.Character:WaitForChild(SelectedPart), Color3.fromRGB(68, 214, 44), 0.3, 3) |
68 | handler.Name = player.Name |
69 | player.CharacterAdded:connect(function(Char) handler.Adornee = Char:WaitForChild(SelectedPart) end) |
70 | |
71 | |
72 | spawn(function() |
73 | while wait() do |
74 | if player.Character then |
75 | end |
76 | end |
77 | end) |
78 | end |
79 | |
80 | for i = 1, #data do |
81 | if data[i] ~= game.Players.LocalPlayer then |
82 | noob(data[i]) |
83 | end |
84 | end |
85 | |
86 | game.Players.PlayerAdded:connect(function(Player) |
87 | noob(Player) |
88 | end) |
89 | |
90 | spawn(function() |
91 | placemarker.Anchored = true |
92 | placemarker.CanCollide = false |
93 | if Settings.rewrittenmain.DOT == true then |
94 | placemarker.Size = Vector3.new(6, 6, 6) |
95 | else |
96 | placemarker.Size = Vector3.new(0, 0, 0) |
97 | end |
98 | placemarker.Transparency = 1 |
99 | if Settings.rewrittenmain.DOT then |
100 | makemarker(placemarker, placemarker, Color3.fromRGB(68, 214, 44), 0.40, 0) |
101 | end |
102 | end) |
103 | |
104 | game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(k) |
105 | if k == Settings.rewrittenmain.Key and Settings.rewrittenmain.Enabled then |
106 | if enabled == true then |
107 | enabled = false |
108 | if Settings.rewrittenmain.NOTIF == true then |
109 | Plr = getClosestPlayerToCursor() |
110 | game.StarterGui:SetCore("SendNotification", { |
111 | Title = "Lock Notification", |
112 | Text = "Unlocked", |
113 | Icon = "", |
114 | Duration = 1, |
115 | }) |
116 | end |
117 | else |
118 | Plr = getClosestPlayerToCursor() |
119 | enabled = true |
120 | if Settings.rewrittenmain.NOTIF == true then |
121 | |
122 | game.StarterGui:SetCore("SendNotification", { |
123 | Title = "Lock Notification", |
124 | Text = "Locked On :"..tostring(Plr.Name); |
125 | Icon = "", |
126 | Duration = 1, |
127 | }) |
128 | |
129 | end |
130 | end |
131 | end |
132 | end) |
133 | |
134 | |
135 | |
136 | function getClosestPlayerToCursor() |
137 | local closestPlayer |
138 | local shortestDistance = Settings.rewrittenmain.FOV |
139 | |
140 | for i, v in pairs(game.Players:GetPlayers()) do |
141 | if v ~= game.Players.LocalPlayer and v.Character and v.Character:FindFirstChild("Humanoid") and v.Character.Humanoid.Health ~= 0 and v.Character:FindFirstChild("HumanoidRootPart") then |
142 | local pos = CC:WorldToViewportPoint(v.Character.PrimaryPart.Position) |
143 | local magnitude = (Vector2.new(pos.X, pos.Y) - Vector2.new(mouse.X, mouse.Y)).magnitude |
144 | if magnitude < shortestDistance then |
145 | closestPlayer = v |
146 | shortestDistance = magnitude |
147 | end |
148 | end |
149 | end |
150 | return closestPlayer |
151 | end |
152 | |
153 | local pingvalue = nil; |
154 | local split = nil; |
155 | local ping = nil; |
156 | |
157 | game:GetService"RunService".Stepped:connect(function() |
158 | if enabled and Plr.Character ~= nil and Plr.Character:FindFirstChild("HumanoidRootPart") then |
159 | placemarker.CFrame = CFrame.new(Plr.Character.HumanoidRootPart.Position+(Plr.Character.HumanoidRootPart.Velocity*accomidationfactor)) |
160 | else |
161 | placemarker.CFrame = CFrame.new(0, 9999, 0) |
162 | end |
163 | if Settings.rewrittenmain.AUTOPRED == true then |
164 | pingvalue = game:GetService("Stats").Network.ServerStatsItem["Data Ping"]:GetValueString() |
165 | split = string.split(pingvalue,'(') |
166 | ping = tonumber(split[1]) |
167 | if ping < 130 then |
168 | PredictionValue = 0.151 |
169 | elseif ping < 125 then |
170 | PredictionValue = 0.149 |
171 | elseif ping < 110 then |
172 | PredictionValue = 0.146 |
173 | elseif ping < 105 then |
174 | PredictionValue = 0.138 |
175 | elseif ping < 90 then |
176 | PredictionValue = 0.136 |
177 | elseif ping < 80 then |
178 | PredictionValue = 0.134 |
179 | elseif ping < 70 then |
180 | PredictionValue = 0.131 |
181 | elseif ping < 60 then |
182 | PredictionValue = 0.1229 |
183 | elseif ping < 50 then |
184 | PredictionValue = 0.1225 |
185 | elseif ping < 40 then |
186 | PredictionValue = 0.1256 |
187 | end |
188 | end |
189 | end) |
190 | |
191 | local mt = getrawmetatable(game) |
192 | local old = mt.__namecall |
193 | setreadonly(mt, false) |
194 | mt.__namecall = newcclosure(function(...) |
195 | local args = {...} |
196 | if enabled and getnamecallmethod() == "FireServer" and args[2] == "UpdateMousePos" and Settings.rewrittenmain.Enabled and Plr.Character ~= nil then |
197 | |
198 | -- args[3] = Plr.Character.HumanoidRootPart.Position+(Plr.Character.HumanoidRootPart.Velocity*accomidationfactor) |
199 | --[[ |
200 | if Settings.rewrittenmain.AIRSHOT == true then |
201 | if game.Workspace.Players[Plr.Name].Humanoid:GetState() == Enum.HumanoidStateType.Freefall then -- Plr.Character:WaitForChild("Humanoid"):GetState() == Enum.HumanoidStateType.Freefall |
202 | |
203 | --// Airshot |
204 | args[3] = Plr.Character.LeftFoot.Position+(Plr.Character.LeftFoot.Velocity*PredictionValue) |
205 | else |
206 | args[3] = Plr.Character.HumanoidRootPart.Position+(Plr.Character.HumanoidRootPart.Velocity*PredictionValue) |
207 | end |
208 | else |
209 | args[3] = Plr.Character.HumanoidRootPart.Position+(Plr.Character.HumanoidRootPart.Velocity*PredictionValue) |
210 | end |
211 | ]] |
212 | if Prediction == true then |
213 | |
214 | args[3] = Plr.Character[SelectedPart].Position+(Plr.Character[SelectedPart].Velocity*PredictionValue) |
215 | |
216 | else |
217 | |
218 | args[3] = Plr.Character[SelectedPart].Position |
219 | |
220 | end |
221 | |
222 | return old(unpack(args)) |
223 | end |
224 | return old(...) |
225 | end) |
226 | |
227 | game:GetService("RunService").RenderStepped:Connect(function() |
228 | if Settings.rewrittenmain.RESOVLER == true and Plr.Character ~= nil and enabled and Settings.rewrittenmain.Enabled then |
229 | if Settings.rewrittenmain.AIRSHOT == true and enabled and Plr.Character ~= nil then |
230 | |
231 | if game.Workspace.Players[Plr.Name].Humanoid:GetState() == Enum.HumanoidStateType.Freefall then -- Plr.Character:WaitForChild("Humanoid"):GetState() == Enum.HumanoidStateType.Freefall |
232 | |
233 | --// Airshot |
234 | |
235 | --// Anchor Check |
236 | |
237 | if Plr.Character ~= nil and Plr.Character.HumanoidRootPart.Anchored == true then |
238 | AnchorCount = AnchorCount + 1 |
239 | if AnchorCount >= MaxAnchor then |
240 | Prediction = false |
241 | wait(2) |
242 | AnchorCount = 0; |
243 | end |
244 | else |
245 | Prediction = true |
246 | AnchorCount = 0; |
247 | end |
248 | |
249 | SelectedPart = "HumanoidRootPart" |
250 | |
251 | else |
252 | --// Anchor Check |
253 | |
254 | if Plr.Character ~= nil and Plr.Character.HumanoidRootPart.Anchored == true then |
255 | AnchorCount = AnchorCount + 1 |
256 | if AnchorCount >= MaxAnchor then |
257 | Prediction = false |
258 | wait(2) |
259 | AnchorCount = 0; |
260 | end |
261 | else |
262 | Prediction = true |
263 | AnchorCount = 0; |
264 | end |
265 | |
266 | SelectedPart = "HumanoidRootPart" |
267 | |
268 | end |
269 | else |
270 | |
271 | --// Anchor Check |
272 | |
273 | if Plr.Character ~= nil and Plr.Character.HumanoidRootPart.Anchored == true then |
274 | AnchorCount = AnchorCount + 1 |
275 | if AnchorCount >= MaxAnchor then |
276 | Prediction = false |
277 | wait(2) |
278 | AnchorCount = 0; |
279 | end |
280 | else |
281 | Prediction = true |
282 | AnchorCount = 0; |
283 | end |
284 | |
285 | SelectedPart = "HumanoidRootPart" |
286 | end |
287 | |
288 | else |
289 | SelectedPart = "HumanoidRootPart" |
290 | end |
291 | end) |
292 | |
293 | --the cam lock |
294 | |
295 | getgenv().Prediction = 0.143105125985120958176 |
296 | getgenv().AimPart = "UpperTorso" |
297 | getgenv().Key = "Q" |
298 | getgenv().DisableKey = "P" |
299 | |
300 | getgenv().FOV = true |
301 | getgenv().ShowFOV = false |
302 | getgenv().FOVSize = 55 |
303 | |
304 | --// Variables (Service) |
305 | |
306 | local Players = game:GetService("Players") |
307 | local RS = game:GetService("RunService") |
308 | local WS = game:GetService("Workspace") |
309 | local GS = game:GetService("GuiService") |
310 | local SG = game:GetService("StarterGui") |
311 | |
312 | --// Variables (regular) |
313 | |
314 | local LP = Players.LocalPlayer |
315 | local Mouse = LP:GetMouse() |
316 | local Camera = WS.CurrentCamera |
317 | local GetGuiInset = GS.GetGuiInset |
318 | |
319 | local AimlockState = true |
320 | local Locked |
321 | local Victim |
322 | |
323 | local SelectedKey = getgenv().Key |
324 | local SelectedDisableKey = getgenv().DisableKey |
325 | |
326 | --// Check if aimlock is loaded |
327 | |
328 | if getgenv().Loaded == true then |
329 | Notify("Aimlock is already loaded!") |
330 | return |
331 | end |
332 | |
333 | getgenv().Loaded = true |
334 | |
335 | --// FOV Circle |
336 | |
337 | local fov = Drawing.new("Circle") |
338 | fov.Filled = false |
339 | fov.Transparency = 1 |
340 | fov.Thickness = 1 |
341 | fov.Color = Color3.fromRGB(255, 255, 0) |
342 | fov.NumSides = 1000 |
343 | |
344 | --// Functions |
345 | |
346 | function update() |
347 | if getgenv().FOV == true then |
348 | if fov then |
349 | fov.Radius = getgenv().FOVSize * 2 |
350 | fov.Visible = getgenv().ShowFOV |
351 | fov.Position = Vector2.new(Mouse.X, Mouse.Y + GetGuiInset(GS).Y) |
352 | |
353 | return fov |
354 | end |
355 | end |
356 | end |
357 | |
358 | function WTVP(arg) |
359 | return Camera:WorldToViewportPoint(arg) |
360 | end |
361 | |
362 | function WTSP(arg) |
363 | return Camera.WorldToScreenPoint(Camera, arg) |
364 | end |
365 | |
366 | function getClosest() |
367 | local closestPlayer |
368 | local shortestDistance = math.huge |
369 | |
370 | for i, v in pairs(game.Players:GetPlayers()) do |
371 | local notKO = v.Character:WaitForChild("BodyEffects")["K.O"].Value ~= true |
372 | local notGrabbed = v.Character:FindFirstChild("GRABBING_COINSTRAINT") == nil |
373 | |
374 | if v ~= game.Players.LocalPlayer and v.Character and v.Character:FindFirstChild("Humanoid") and v.Character.Humanoid.Health ~= 0 and v.Character:FindFirstChild(getgenv().AimPart) and notKO and notGrabbed then |
375 | local pos = Camera:WorldToViewportPoint(v.Character.PrimaryPart.Position) |
376 | local magnitude = (Vector2.new(pos.X, pos.Y) - Vector2.new(Mouse.X, Mouse.Y)).magnitude |
377 | |
378 | if (getgenv().FOV) then |
379 | if (fov.Radius > magnitude and magnitude < shortestDistance) then |
380 | closestPlayer = v |
381 | shortestDistance = magnitude |
382 | end |
383 | else |
384 | if (magnitude < shortestDistance) then |
385 | closestPlayer = v |
386 | shortestDistance = magnitude |
387 | end |
388 | end |
389 | end |
390 | end |
391 | return closestPlayer |
392 | end |
393 | |
394 | --// Checks if key is down |
395 | |
396 | Mouse.KeyDown:Connect(function(k) |
397 | SelectedKey = SelectedKey:lower() |
398 | SelectedDisableKey = SelectedDisableKey:lower() |
399 | if k == SelectedKey then |
400 | if AimlockState == true then |
401 | Locked = not Locked |
402 | if Locked then |
403 | Victim = getClosest() |
404 | |
405 | Notify("Locked onto: "..tostring(Victim.Character.Humanoid.DisplayName)) |
406 | else |
407 | if Victim ~= nil then |
408 | Victim = nil |
409 | |
410 | Notify("Unlocked!") |
411 | end |
412 | end |
413 | else |
414 | Notify("Aimlock is not enabled!") |
415 | end |
416 | end |
417 | if k == SelectedDisableKey then |
418 | AimlockState = not AimlockState |
419 | end |
420 | end) |
421 | |
422 | --// Loop update FOV and loop camera lock onto target |
423 | |
424 | RS.RenderStepped:Connect(function() |
425 | update() |
426 | if AimlockState == true then |
427 | if Victim ~= nil then |
428 | Camera.CFrame = CFrame.new(Camera.CFrame.p, Victim.Character[getgenv().AimPart].Position + Victim.Character[getgenv().AimPart].Velocity*getgenv().Prediction) |
429 | end |
430 | end |
431 | end) |
432 | while wait() do |
433 | if getgenv().AutoPrediction == true then |
434 | local pingvalue = game:GetService("Stats").Network.ServerStatsItem["Data Ping"]:GetValueString() |
435 | local split = string.split(pingvalue,'(') |
436 | local ping = tonumber(split[1]) |
437 | if ping < 225 then |
438 | getgenv().Prediction = 1.4 |
439 | elseif ping < 215 then |
440 | getgenv().Prediction = 1.2 |
441 | elseif ping < 205 then |
442 | getgenv().Prediction = 1.0 |
443 | elseif ping < 190 then |
444 | getgenv().Prediction = 0.10 |
445 | elseif ping < 180 then |
446 | getgenv().Prediction = 0.12 |
447 | elseif ping < 170 then |
448 | getgenv().Prediction = 0.15 |
449 | elseif ping < 160 then |
450 | getgenv().Prediction = 0.18 |
451 | elseif ping < 150 then |
452 | getgenv().Prediction = 0.110 |
453 | elseif ping < 140 then |
454 | getgenv().Prediction = 0.113 |
455 | elseif ping < 130 then |
456 | getgenv().Prediction = 0.116 |
457 | elseif ping < 120 then |
458 | getgenv().Prediction = 0.120 |
459 | elseif ping < 110 then |
460 | getgenv().Prediction = 0.124 |
461 | elseif ping < 105 then |
462 | getgenv().Prediction = 0.127 |
463 | elseif ping < 90 then |
464 | getgenv().Prediction = 0.130 |
465 | elseif ping < 80 then |
466 | getgenv().Prediction = 0.133 |
467 | elseif ping < 70 then |
468 | getgenv().Prediction = 0.136 |
469 | elseif ping < 60 then |
470 | getgenv().Prediction = 0.140 |
471 | elseif ping < 50 then |
472 | getgenv().Prediction = 0.143 |
473 | elseif ping < 40 then |
474 | getgenv().Prediction = 0.145 |
475 | elseif ping < 30 then |
476 | getgenv().Prediction = 0.155 |
477 | elseif ping < 20 then |
478 | getgenv().Prediction = 0.157 |
479 | end |
480 | end |
481 | end |