local AimbotDistance = 50 local CharacterTilt = false local Workspace = game:GetService("Workspace") local RunService = game:GetService("RunService") local Players = game:GetService("Players") local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local function calculateDistance(pos1, pos2) return (pos1 - pos2).Magnitude end local function getNearestCharacter() local closestCharacter = nil local shortestDistance = math.huge for _, obj in ipairs(character.Parent:GetChildren()) do if obj ~= character and obj:FindFirstChild("HumanoidRootPart") and obj:FindFirstChild("Humanoid") then local otherRoot = obj.HumanoidRootPart local playerRoot = character:FindFirstChild("HumanoidRootPart") if playerRoot then local distanceToTarget = calculateDistance(playerRoot.Position, otherRoot.Position) if distanceToTarget < shortestDistance and distanceToTarget <= AimbotDistance then shortestDistance = distanceToTarget closestCharacter = obj end end end end return closestCharacter end local function aimAtTarget(target) local playerRoot = character:FindFirstChild("HumanoidRootPart") if playerRoot and target and target:FindFirstChild("HumanoidRootPart") then local targetPosition = target.HumanoidRootPart.Position local direction if CharacterTilt then direction = (targetPosition - playerRoot.Position).Unit else direction = Vector3.new( targetPosition.X - playerRoot.Position.X, 0, targetPosition.Z - playerRoot.Position.Z ).Unit end playerRoot.CFrame = CFrame.new(playerRoot.Position, playerRoot.Position + direction) end end RunService.RenderStepped:Connect(function() local nearestCharacter = getNearestCharacter() if nearestCharacter then aimAtTarget(nearestCharacter) end end)