-- Configurações iniciais local aimlockEnabled = false local maxDistance = 30 local buttonSize = UDim2.new(0, 60, 0, 60) local buttonPosition = UDim2.new(0, 20, 0, 20) -- Criar a interface local screenGui = Instance.new("ScreenGui") screenGui.Name = "AimlockGUI" screenGui.Parent = game:GetService("CoreGui") local aimButton = Instance.new("TextButton") aimButton.Name = "AimlockButton" aimButton.Size = buttonSize aimButton.Position = buttonPosition aimButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0) aimButton.TextColor3 = Color3.fromRGB(255, 255, 255) aimButton.Text = "AIM OFF" aimButton.Font = Enum.Font.SourceSansBold aimButton.TextSize = 14 aimButton.BorderSizePixel = 2 aimButton.BorderColor3 = Color3.fromRGB(255, 255, 255) aimButton.Active = true aimButton.Draggable = false aimButton.Parent = screenGui -- Variáveis para arrastar local dragging = false local dragInput, dragStart, startPos -- Função para encontrar o jogador mais próximo function findNearestPlayer() local closestPlayer = nil local closestDistance = maxDistance for _, player in pairs(game:GetService("Players"):GetPlayers()) do if player ~= game:GetService("Players").LocalPlayer and player.Character then local humanoidRootPart = player.Character:FindFirstChild("HumanoidRootPart") local head = player.Character:FindFirstChild("Head") if humanoidRootPart and head then local distance = (game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.Position - humanoidRootPart.Position).Magnitude if distance <= closestDistance then closestDistance = distance closestPlayer = player end end end end return closestPlayer end -- Função de aimlock function aimlock() if not aimlockEnabled then return end local nearestPlayer = findNearestPlayer() if not nearestPlayer or not nearestPlayer.Character then return end local head = nearestPlayer.Character:FindFirstChild("Head") if not head then return end local camera = workspace.CurrentCamera if camera then camera.CFrame = CFrame.new(camera.CFrame.Position, head.Position) end end -- Conectar eventos de input para arrastar aimButton.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = aimButton.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) aimButton.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then dragInput = input end end) aimButton.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = false end end) -- Atualizar posição do botão enquanto arrasta game:GetService("UserInputService").InputChanged:Connect(function(input) if dragging and (input == dragInput) then local delta = input.Position - dragStart aimButton.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end end) -- Toggle do aimlock aimButton.MouseButton1Click:Connect(function() aimlockEnabled = not aimlockEnabled if aimlockEnabled then aimButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0) aimButton.Text = "AIM ON" else aimButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0) aimButton.Text = "AIM OFF" end end) -- Loop principal do aimlock while true do if aimlockEnabled then pcall(aimlock) -- Usar pcall para evitar erros end wait(0.1) -- Atualizar a cada 0.1 segundos end