-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCamLock
More file actions
48 lines (48 loc) · 1.58 KB
/
CamLock
File metadata and controls
48 lines (48 loc) · 1.58 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
getgenv().Aimbot = {Status=true,Keybind="T",Hitpart="HumanoidRootPart",Prediction={X=0.165,Y=0.1}};
if getgenv().AimbotRan then
return;
else
getgenv().AimbotRan = true;
end
local RunService = game:GetService("RunService");
local Workspace = game:GetService("Workspace");
local Players = game:GetService("Players");
local LocalPlayer = Players.LocalPlayer;
local Camera = Workspace.CurrentCamera;
local Mouse = LocalPlayer:GetMouse();
local Player = nil;
local GetClosestPlayer = function()
local ClosestDistance, ClosestPlayer = 100000, nil;
for _, Player in pairs(Players:GetPlayers()) do
if ((Player.Name ~= LocalPlayer.Name) and Player.Character and Player.Character:FindFirstChild("HumanoidRootPart")) then
local Root, Visible = Camera:WorldToScreenPoint(Player.Character.HumanoidRootPart.Position);
if not Visible then
continue;
end
Root = (Vector2.new(Mouse.X, Mouse.Y) - Vector2.new(Root.X, Root.Y)).Magnitude;
if (Root < ClosestDistance) then
ClosestPlayer = Player;
ClosestDistance = Root;
end
end
end
return ClosestPlayer;
end;
Mouse.KeyDown:Connect(function(key)
if (key == Aimbot.Keybind:lower()) then
Player = (not Player and GetClosestPlayer()) or nil;
end
end);
RunService.RenderStepped:Connect(function()
if not Player then
return;
end
if not Aimbot.Status then
return;
end
local Hitpart = Player.Character:FindFirstChild(Aimbot.Hitpart);
if not Hitpart then
return;
end
Camera.CFrame = CFrame.new(Camera.CFrame.Position, Hitpart.Position + (Hitpart.Velocity * Vector3.new(Aimbot.Prediction.X, Aimbot.Prediction.Y, Aimbot.Prediction.X)));
end);