local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local LocalPlayer = Players.LocalPlayer local Camera = workspace.CurrentCamera local ScriptEnabled = true local LastAttacker = nil local LastHealth = nil local TrailObject = nil local TrailAttachment = nil local AttackerBox = Drawing.new("Square") AttackerBox.Thickness = 2 AttackerBox.Filled = false AttackerBox.Visible = false AttackerBox.Color = Color3.new(1, 0, 0) AttackerBox.Size = Vector2.new(60, 90) -- фиксированный размер local function CreateCreditLabel() if LocalPlayer:FindFirstChild("PlayerGui") then local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "CreditGui" ScreenGui.Parent = LocalPlayer.PlayerGui local CreditLabel = Instance.new("TextLabel") CreditLabel.Parent = ScreenGui CreditLabel.Text = "By DoodScriptBoy" CreditLabel.Position = UDim2.new(1, -10, 1, -20) CreditLabel.AnchorPoint = Vector2.new(1, 1) CreditLabel.Size = UDim2.new(0, 120, 0, 20) CreditLabel.BackgroundTransparency = 1 CreditLabel.TextColor3 = Color3.new(0, 0, 0) CreditLabel.TextSize = 12 CreditLabel.Font = Enum.Font.SourceSans CreditLabel.ZIndex = 10 end end local function RemoveCreditLabel() local gui = LocalPlayer:FindFirstChild("PlayerGui"):FindFirstChild("CreditGui") if gui then gui:Destroy() end end local function RemoveTrail() if TrailObject then TrailObject:Destroy() TrailObject = nil end if TrailAttachment then TrailAttachment:Destroy() TrailAttachment = nil end end local function CreateTrail(character) RemoveTrail() local root = character:FindFirstChild("HumanoidRootPart") if not root then return end local attachment = Instance.new("Attachment") attachment.Parent = root local trail = Instance.new("Trail") trail.Parent = root trail.Attachment0 = attachment trail.Attachment1 = attachment trail.Color = ColorSequence.new(Color3.fromRGB(128, 0, 255)) trail.LightEmission = 1 trail.Lifetime = 0.3 trail.MinLength = 0.1 trail.MaxLength = 1 trail.Enabled = true TrailObject = trail TrailAttachment = attachment end local function OnCharacterAdded(character) if ScriptEnabled then CreateTrail(character) end end if LocalPlayer.Character then OnCharacterAdded(LocalPlayer.Character) end LocalPlayer.CharacterAdded:Connect(OnCharacterAdded) CreateCreditLabel() local AimLock = { Enabled = false, Target = nil, FOV = 250, Smoothness = 0.35, Prediction = 0.15 } local FOVCircle = Drawing.new("Circle") FOVCircle.Color = Color3.fromRGB(255, 0, 0) FOVCircle.Thickness = 1.5 FOVCircle.Radius = AimLock.FOV FOVCircle.Transparency = 0.7 FOVCircle.Visible = false FOVCircle.Filled = false local function GetTargetByLookDirection() local nearest = nil local shortestAngle = math.rad(30) local cameraCFrame = Camera.CFrame local cameraForward = cameraCFrame.LookVector for _, player in pairs(Players:GetPlayers()) do if player ~= LocalPlayer and player.Character then local humanoid = player.Character:FindFirstChild("Humanoid") local humanoidRootPart = player.Character:FindFirstChild("HumanoidRootPart") if humanoid and humanoidRootPart and humanoid.Health > 0 then local targetDirection = (humanoidRootPart.Position - cameraCFrame.Position).Unit local angle = math.acos(math.clamp(cameraForward:Dot(targetDirection), -1, 1)) if angle < shortestAngle then shortestAngle = angle nearest = player end end end end return nearest end local function GetNearestToCursor() local nearest = nil local shortestDistance = AimLock.FOV for _, player in pairs(Players:GetPlayers()) do if player ~= LocalPlayer and player.Character then local humanoid = player.Character:FindFirstChild("Humanoid") local humanoidRootPart = player.Character:FindFirstChild("HumanoidRootPart") if humanoid and humanoidRootPart and humanoid.Health > 0 then local screenPos, onScreen = Camera:WorldToScreenPoint(humanoidRootPart.Position) if onScreen then local mousePos = UserInputService:GetMouseLocation() local distance = (Vector2.new(screenPos.X, screenPos.Y) - mousePos).Magnitude if distance < shortestDistance then shortestDistance = distance nearest = player end end end end end return nearest end local function AimAtTarget() if not AimLock.Enabled or not AimLock.Target then return end local target = AimLock.Target local character = target.Character if character then local humanoidRootPart = character:FindFirstChild("HumanoidRootPart") local humanoid = character:FindFirstChild("Humanoid") if humanoidRootPart and humanoid and humanoid.Health > 0 then local targetPos = humanoidRootPart.Position if humanoidRootPart.Velocity then targetPos = targetPos + (humanoidRootPart.Velocity * AimLock.Prediction) end local cameraPos = Camera.CFrame.Position local lookAt = CFrame.new(cameraPos, targetPos) Camera.CFrame = Camera.CFrame:Lerp(lookAt, AimLock.Smoothness) else AimLock.Target = nil end else AimLock.Target = nil end end local function ToggleAimLock() if not ScriptEnabled then return end AimLock.Enabled = not AimLock.Enabled if AimLock.Enabled then AimLock.Target = GetTargetByLookDirection() if not AimLock.Target then AimLock.Target = GetNearestToCursor() end if AimLock.Target then print("Aim Lock ON - Target: " .. AimLock.Target.Name) else print("Aim Lock ON - No target found") end else print("Aim Lock OFF") AimLock.Target = nil end end local function TeleportToAttacker() if not ScriptEnabled then return end if not LastAttacker or not LastAttacker.Character then return end local targetRoot = LastAttacker.Character:FindFirstChild("HumanoidRootPart") local myRoot = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart") if not targetRoot or not myRoot then return end local offset = Vector3.new(0, 0, 3) local direction = (myRoot.Position - targetRoot.Position).Unit local newPos = targetRoot.Position + direction * offset.Magnitude myRoot.CFrame = CFrame.new(newPos, targetRoot.Position) print("Teleported to " .. LastAttacker.Name) end local function ToggleScript() ScriptEnabled = not ScriptEnabled if ScriptEnabled then print("Script enabled") CreateCreditLabel() if LocalPlayer.Character then CreateTrail(LocalPlayer.Character) end else print("Script disabled") AimLock.Enabled = false AimLock.Target = nil RemoveCreditLabel() LastAttacker = nil AttackerBox.Visible = false RemoveTrail() end end UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.P then ToggleScript() return end if not ScriptEnabled then return end if input.UserInputType == Enum.UserInputType.MouseButton2 then ToggleAimLock() elseif input.KeyCode == Enum.KeyCode.O then TeleportToAttacker() end end) local function CheckForDamage() if not ScriptEnabled then return end local character = LocalPlayer.Character if not character then return end local humanoid = character:FindFirstChild("Humanoid") if not humanoid then return end if LastHealth == nil then LastHealth = humanoid.Health return end if humanoid.Health < LastHealth then local nearestPlayer = nil local nearestDistance = 25 local localRoot = character:FindFirstChild("HumanoidRootPart") if localRoot then for _, player in pairs(Players:GetPlayers()) do if player ~= LocalPlayer and player.Character then local targetRoot = player.Character:FindFirstChild("HumanoidRootPart") local targetHumanoid = player.Character:FindFirstChild("Humanoid") if targetRoot and targetHumanoid and targetHumanoid.Health > 0 then local dist = (targetRoot.Position - localRoot.Position).Magnitude if dist < nearestDistance then nearestDistance = dist nearestPlayer = player end end end end end if nearestPlayer then LastAttacker = nearestPlayer print("Attacker: " .. LastAttacker.Name) end end LastHealth = humanoid.Health end local function UpdateAttackerBox() if not ScriptEnabled then AttackerBox.Visible = false return end if LastAttacker and LastAttacker.Character then local character = LastAttacker.Character local humanoid = character:FindFirstChild("Humanoid") local rootPart = character:FindFirstChild("HumanoidRootPart") if humanoid and humanoid.Health > 0 and rootPart then local screenPos, onScreen = Camera:WorldToScreenPoint(rootPart.Position) if onScreen then local boxWidth = 60 local boxHeight = 90 local centerX = screenPos.X local topY = screenPos.Y + 30 -- рамка ниже центра AttackerBox.Position = Vector2.new(centerX - boxWidth / 2, topY) AttackerBox.Size = Vector2.new(boxWidth, boxHeight) AttackerBox.Visible = true else AttackerBox.Visible = false end else AttackerBox.Visible = false if not humanoid or humanoid.Health <= 0 then LastAttacker = nil end end else AttackerBox.Visible = false if LastAttacker and not LastAttacker.Character then LastAttacker = nil end end end RunService.RenderStepped:Connect(function() if not ScriptEnabled then return end local mousePos = UserInputService:GetMouseLocation() FOVCircle.Position = Vector2.new(mousePos.X, mousePos.Y) FOVCircle.Radius = AimLock.FOV CheckForDamage() UpdateAttackerBox() if AimLock.Enabled then if not AimLock.Target or not AimLock.Target.Character or not AimLock.Target.Character:FindFirstChild("Humanoid") or AimLock.Target.Character.Humanoid.Health <= 0 then AimLock.Target = GetTargetByLookDirection() or GetNearestToCursor() if AimLock.Target then print("New target: " .. AimLock.Target.Name) end end AimAtTarget() end end) Players.PlayerRemoving:Connect(function(player) if player == LastAttacker then LastAttacker = nil print("Attacker left") end if player == AimLock.Target then AimLock.Target = nil print("Target left the game") end end) print("Author: DoodScriptBoy [Discord: zeyrt]") print("RMB - aim lock, O - teleport to attacker, P - on/off")