local UIS = game:GetService("UserInputService") local RunService = game:GetService("RunService") local Players = game:GetService("Players") local LocalPlayer = Players.LocalPlayer local Camera = workspace.CurrentCamera -- Configuration local SMOOTHNESS = 0.15 local FIELD_OF_VIEW = 40 local AIM_KEY = Enum.UserInputType.MouseButton2 -- Right Click local isAiming = false -- Keybind Toggle Logic UIS.InputBegan:Connect(function(input) if input.UserInputType == AIM_KEY then isAiming = true end end) UIS.InputEnded:Connect(function(input) if input.UserInputType == AIM_KEY then isAiming = false end end) function getClosestTarget() local closestTarget = nil local shortestDistance = math.huge for _, player in pairs(Players:GetPlayers()) do -- Ensure player is alive and has a body if player ~= LocalPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then local screenPos, onScreen = Camera:WorldToViewportPoint(player.Character.HumanoidRootPart.Position) if onScreen then local mousePos = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y / 2) local distance = (Vector2.new(screenPos.X, screenPos.Y) - mousePos).Magnitude -- Check if target is within our FOV circle if distance < shortestDistance and distance < FIELD_OF_VIEW * 10 then shortestDistance = distance closestTarget = player.Character.HumanoidRootPart end end end end return closestTarget end RunService.RenderStepped:Connect(function() -- Only run the math if the Right Mouse Button is held down if isAiming then local target = getClosestTarget() if target then local targetRotation = CFrame.new(Camera.CFrame.Position, target.Position) Camera.CFrame = Camera.CFrame:Lerp(targetRotation, SMOOTHNESS) end end end) ----- local RunService = game:GetService("RunService") local Players = game:GetService("Players") local LocalPlayer = Players.LocalPlayer local Camera = workspace.CurrentCamera -- Configuration local LINE_THICKNESS = 2 local RAINBOW_SPEED = 0.5 -- Higher is faster color shifting -- Function to create the ESP elements local function createESP(targetPlayer) local character = targetPlayer.Character or targetPlayer.CharacterAdded:Wait() -- 1. Create the Highlight (The Rainbow Glow) local highlight = Instance.new("Highlight") highlight.Name = "ESPHighlight" highlight.Parent = character highlight.FillTransparency = 0.5 highlight.OutlineTransparency = 0 -- 2. Create the Tracer Line (Drawing on the Screen) local line = Drawing.new("Line") line.Visible = false line.Thickness = LINE_THICKNESS line.Transparency = 1 return highlight, line end -- Table to track ESP objects local espData = {} RunService.RenderStepped:Connect(function() local t = tick() * RAINBOW_SPEED local rainbowColor = Color3.fromHSV(t % 1, 1, 1) -- Math for shifting hue for _, player in pairs(Players:GetPlayers()) do if player ~= LocalPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then local rootPart = player.Character.HumanoidRootPart local screenPos, onScreen = Camera:WorldToViewportPoint(rootPart.Position) -- Get or Create ESP for this player if not espData[player] then local h, l = createESP(player) espData[player] = {Highlight = h, Line = l} end local data = espData[player] -- Update Rainbow Color data.Highlight.FillColor = rainbowColor data.Highlight.OutlineColor = rainbowColor -- Update Tracer Line if onScreen then data.Line.From = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y) -- Bottom Middle data.Line.To = Vector2.new(screenPos.X, screenPos.Y) data.Line.Color = rainbowColor data.Line.Visible = true else data.Line.Visible = false end end end end)