local player = game.Players.LocalPlayer local camera = workspace.CurrentCamera local runService = game:GetService("RunService") local userInputService = game:GetService("UserInputService") local screenGui = Instance.new("ScreenGui") screenGui.Name = "Aimbot" screenGui.ResetOnSpawn = false screenGui.Parent = game.CoreGui local mainFrame = Instance.new("Frame") mainFrame.Size = UDim2.new(0, 220, 0, 130) mainFrame.Position = UDim2.new(0.5, -110, 0.5, -65) mainFrame.BackgroundColor3 = Color3.fromRGB(15, 15, 15) mainFrame.BorderSizePixel = 0 mainFrame.Parent = screenGui Instance.new("UICorner", mainFrame) local titleBar = Instance.new("Frame") titleBar.Size = UDim2.new(1, 0, 0, 35) titleBar.BackgroundColor3 = Color3.fromRGB(25, 25, 25) titleBar.Parent = mainFrame Instance.new("UICorner", titleBar) local titleText = Instance.new("TextLabel") titleText.Size = UDim2.new(1, 0, 1, 0) titleText.Text = "open source" titleText.TextColor3 = Color3.fromRGB(0, 255, 150) titleText.Font = Enum.Font.SourceSansBold titleText.BackgroundTransparency = 1 titleText.Parent = titleBar local lockBtn = Instance.new("TextButton") lockBtn.Size = UDim2.new(1, -20, 0, 50) lockBtn.Position = UDim2.new(0, 10, 0, 55) lockBtn.Text = "Aimbot: OFF" lockBtn.BackgroundColor3 = Color3.fromRGB(40, 40, 40) lockBtn.TextColor3 = Color3.new(1, 1, 1) lockBtn.Font = Enum.Font.SourceSansBold lockBtn.Parent = mainFrame Instance.new("UICorner", lockBtn) local dragging, dragStart, startPos titleBar.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = mainFrame.Position end end) userInputService.InputChanged:Connect(function(input) if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then local delta = input.Position - dragStart mainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y) end end) userInputService.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = false end end) local function isVisible(targetPart) local char = player.Character if not char or not targetPart then return false end local params = RaycastParams.new() params.FilterDescendantsInstances = {char, screenGui, camera} params.FilterType = Enum.RaycastFilterType.Exclude local ray = workspace:Raycast(camera.CFrame.Position, (targetPart.Position - camera.CFrame.Position).Unit * 1000, params) if ray and ray.Instance:IsDescendantOf(targetPart.Parent) then return true end return false end local aimbotEnabled = false local currentTarget = nil local function getNearestVisibleEnemy() local nearest = nil local shortestDistance = math.huge for _, p in pairs(game.Players:GetPlayers()) do -- TEAM CHECK: Must not be on our team and must be alive if p ~= player and p.Team ~= player.Team and p.Character and p.Character:FindFirstChild("Head") and p.Character.Humanoid.Health > 0 then if isVisible(p.Character.Head) then local dist = (player.Character.HumanoidRootPart.Position - p.Character.HumanoidRootPart.Position).Magnitude if dist < shortestDistance then shortestDistance = dist nearest = p end end end end return nearest end lockBtn.MouseButton1Click:Connect(function() aimbotEnabled = not aimbotEnabled lockBtn.Text = aimbotEnabled and "Aimbot: ON" or "Aimbot: OFF" lockBtn.BackgroundColor3 = aimbotEnabled and Color3.fromRGB(0, 180, 100) or Color3.fromRGB(40, 40, 40) if not aimbotEnabled then currentTarget = nil end end) runService.RenderStepped:Connect(function() if aimbotEnabled then local stillValid = false -- If current target switched teams or died, they are no longer valid if currentTarget and currentTarget.Team ~= player.Team and currentTarget.Character and currentTarget.Character:FindFirstChild("Head") and currentTarget.Character.Humanoid.Health > 0 then if isVisible(currentTarget.Character.Head) then stillValid = true end end if stillValid then camera.CFrame = CFrame.new(camera.CFrame.Position, currentTarget.Character.Head.Position) else currentTarget = getNearestVisibleEnemy() end end end)