local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") local LocalPlayer = Players.LocalPlayer local Camera = workspace.CurrentCamera local HoldingRMB = false -------------------------------------------------- -- ESP -------------------------------------------------- local function CreateESP(Character) if Character:FindFirstChild("ESPHighlight") then return end local Highlight = Instance.new("Highlight") Highlight.Name = "ESPHighlight" Highlight.FillColor = Color3.fromRGB(0,255,65) Highlight.OutlineColor = Color3.fromRGB(255,255,255) Highlight.FillTransparency = 0.6 Highlight.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop Highlight.Parent = Character end local function SetupPlayer(Player) if Player == LocalPlayer then return end local function CharacterAdded(Character) task.wait(0.2) CreateESP(Character) end if Player.Character then CharacterAdded(Player.Character) end Player.CharacterAdded:Connect(CharacterAdded) end for _, Player in ipairs(Players:GetPlayers()) do SetupPlayer(Player) end Players.PlayerAdded:Connect(SetupPlayer) -------------------------------------------------- -- CLOSEST PLAYER TO MOUSE -------------------------------------------------- local function GetClosestPlayer() local ClosestPlayer = nil local ClosestDistance = math.huge local MousePos = UserInputService:GetMouseLocation() for _, Player in ipairs(Players:GetPlayers()) do if Player ~= LocalPlayer and Player.Character and Player.Character:FindFirstChild("Head") and Player.Character:FindFirstChild("Humanoid") and Player.Character.Humanoid.Health > 0 then local ScreenPos, Visible = Camera:WorldToViewportPoint( Player.Character.Head.Position ) if Visible then local Distance = (Vector2.new(ScreenPos.X, ScreenPos.Y) - MousePos).Magnitude if Distance < ClosestDistance then ClosestDistance = Distance ClosestPlayer = Player end end end end return ClosestPlayer end -------------------------------------------------- -- RMB -------------------------------------------------- UserInputService.InputBegan:Connect(function(Input, GP) if GP then return end if Input.UserInputType == Enum.UserInputType.MouseButton2 then HoldingRMB = true end end) UserInputService.InputEnded:Connect(function(Input) if Input.UserInputType == Enum.UserInputType.MouseButton2 then HoldingRMB = false end end) -------------------------------------------------- -- CAMLOCK -------------------------------------------------- RunService.RenderStepped:Connect(function() if not HoldingRMB then return end local Target = GetClosestPlayer() if not Target then return end local Character = Target.Character local Head = Character and Character:FindFirstChild("Head") if not Head then return end local Desired = CFrame.lookAt( Camera.CFrame.Position, Head.Position ) Camera.CFrame = Camera.CFrame:Lerp( Desired, 0.15 ) end)