Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Script de Combate Automático para Roblox
- -- Funcionalidades: Flutuar ao redor dos mobs, Auto Attack e Auto Skill
- local player = game:GetService("Players").LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoid = character:WaitForChild("Humanoid")
- local playerRoot = character:WaitForChild("HumanoidRootPart")
- local mouse = player:GetMouse()
- local UserInputService = game:GetService("UserInputService")
- local RunService = game:GetService("RunService")
- -- Interface GUI
- local ScreenGui = Instance.new("ScreenGui")
- ScreenGui.Parent = player.PlayerGui
- ScreenGui.ResetOnSpawn = false
- local Frame = Instance.new("Frame")
- Frame.Size = UDim2.new(0, 200, 0, 150)
- Frame.Position = UDim2.new(0.8, 0, 0.3, 0)
- Frame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- Frame.BackgroundTransparency = 0.3
- Frame.BorderSizePixel = 2
- Frame.BorderColor3 = Color3.fromRGB(255, 255, 255)
- Frame.Parent = ScreenGui
- local Title = Instance.new("TextLabel")
- Title.Size = UDim2.new(1, 0, 0, 30)
- Title.Text = "Combat Helper"
- Title.TextColor3 = Color3.fromRGB(255, 255, 255)
- Title.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- Title.BorderSizePixel = 0
- Title.Font = Enum.Font.SourceSansBold
- Title.TextSize = 18
- Title.Parent = Frame
- -- Função para criar checkboxes
- local function createCheckbox(name, positionY)
- local checkboxFrame = Instance.new("Frame")
- checkboxFrame.Size = UDim2.new(1, 0, 0, 30)
- checkboxFrame.Position = UDim2.new(0, 0, 0, positionY)
- checkboxFrame.BackgroundTransparency = 1
- checkboxFrame.Parent = Frame
- local label = Instance.new("TextLabel")
- label.Size = UDim2.new(0.7, 0, 1, 0)
- label.Position = UDim2.new(0, 10, 0, 0)
- label.BackgroundTransparency = 1
- label.Text = name
- label.TextColor3 = Color3.fromRGB(255, 255, 255)
- label.Font = Enum.Font.SourceSans
- label.TextSize = 16
- label.TextXAlignment = Enum.TextXAlignment.Left
- label.Parent = checkboxFrame
- local checkbox = Instance.new("Frame")
- checkbox.Size = UDim2.new(0, 20, 0, 20)
- checkbox.Position = UDim2.new(0.85, 0, 0.5, -10)
- checkbox.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- checkbox.BorderColor3 = Color3.fromRGB(255, 255, 255)
- checkbox.Parent = checkboxFrame
- local checked = Instance.new("Frame")
- checked.Size = UDim2.new(0.8, 0, 0.8, 0)
- checked.Position = UDim2.new(0.1, 0, 0.1, 0)
- checked.BackgroundColor3 = Color3.fromRGB(0, 255, 100)
- checked.BorderSizePixel = 0
- checked.Visible = false
- checked.Parent = checkbox
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(1, 0, 1, 0)
- button.BackgroundTransparency = 1
- button.Text = ""
- button.Parent = checkbox
- local enabled = false
- button.MouseButton1Click:Connect(function()
- enabled = not enabled
- checked.Visible = enabled
- end)
- return enabled, button, function() return enabled end
- end
- -- Criar checkboxes para cada função
- local _, _, isFloatEnabled = createCheckbox("Flutuar atrás do Mob", 30)
- local _, _, isAutoAttackEnabled = createCheckbox("Auto Attack", 60)
- local _, _, isAutoSkillEnabled = createCheckbox("Auto Skill", 90)
- -- Função para encontrar o mob mais próximo
- local function findNearestMob()
- local nearestMob = nil
- local minDistance = math.huge
- local maxDistance = 100 -- Distância máxima para detecção de mobs
- for _, v in pairs(workspace:GetDescendants()) do
- if v:IsA("Model") and v:FindFirstChild("Humanoid") and v:FindFirstChild("HumanoidRootPart") then
- if v ~= character and v.Humanoid.Health > 0 then
- local distance = (playerRoot.Position - v.HumanoidRootPart.Position).Magnitude
- if distance < minDistance and distance < maxDistance then
- nearestMob = v
- minDistance = distance
- end
- end
- end
- end
- return nearestMob
- end
- -- Função para flutuar atrás do mob
- local function floatBehindMob(mob)
- if not mob or not mob:FindFirstChild("HumanoidRootPart") then return end
- local mobRoot = mob.HumanoidRootPart
- local mobLookVector = mobRoot.CFrame.LookVector
- -- Posição atrás do mob (costas)
- local behindPosition = mobRoot.Position - (mobLookVector * 5)
- behindPosition = behindPosition + Vector3.new(0, 3, 0) -- Flutuar um pouco acima
- -- Mover o personagem para essa posição
- playerRoot.CFrame = CFrame.new(behindPosition, mobRoot.Position)
- end
- -- Função para simular um ataque
- local function attack()
- local attackEvent = player.Character:FindFirstChild("Attack")
- if attackEvent and attackEvent:IsA("RemoteEvent") then
- attackEvent:FireServer()
- else
- -- Método genérico se não encontrar um evento de ataque específico
- mouse1click() -- Simula um clique do mouse
- end
- end
- -- Função para usar habilidades
- local function useSkill(key)
- -- Simula pressionar uma tecla
- local virtualInputManager = game:GetService("VirtualInputManager")
- virtualInputManager:SendKeyEvent(true, Enum.KeyCode[key], false, game)
- wait(0.1)
- virtualInputManager:SendKeyEvent(false, Enum.KeyCode[key], false, game)
- end
- -- Loop principal
- RunService:BindToRenderStep("CombatHelper", Enum.RenderPriority.Character.Value, function()
- local mob = findNearestMob()
- if not mob then return end
- -- Verificar se o mob está ao alcance
- local distance = (playerRoot.Position - mob.HumanoidRootPart.Position).Magnitude
- local maxAttackDistance = 30 -- Alcance de ataque estendido
- if isFloatEnabled() and mob then
- floatBehindMob(mob)
- end
- if isAutoAttackEnabled() and distance <= maxAttackDistance then
- attack()
- end
- if isAutoSkillEnabled() then
- -- Usar habilidades periodicamente se estiver perto do mob
- if distance <= maxAttackDistance then
- -- Contador para controlar o uso de habilidades
- if not _G.skillTimer then
- _G.skillTimer = 0
- _G.lastSkillUsed = nil
- end
- _G.skillTimer = _G.skillTimer + 1
- -- Usar habilidades em sequência a cada 30 frames (aproximadamente 0.5 segundos)
- if _G.skillTimer >= 30 then
- _G.skillTimer = 0
- if _G.lastSkillUsed == nil or _G.lastSkillUsed == "1" then
- useSkill("R")
- _G.lastSkillUsed = "R"
- elseif _G.lastSkillUsed == "R" then
- useSkill("F")
- _G.lastSkillUsed = "F"
- elseif _G.lastSkillUsed == "F" then
- useSkill("X")
- _G.lastSkillUsed = "X"
- elseif _G.lastSkillUsed == "X" then
- useSkill("One")
- _G.lastSkillUsed = "1"
- end
- end
- end
- end
- end)
- -- Adicionar um botão para arrastar a interface
- local dragButton = Instance.new("TextButton")
- dragButton.Text = "="
- dragButton.Position = UDim2.new(0, 0, 0, 0)
- dragButton.Size = UDim2.new(0, 30, 0, 30)
- dragButton.BackgroundTransparency = 0.5
- dragButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- dragButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- dragButton.Parent = Frame
- -- Função para permitir arrastar a interface
- local dragging
- local dragInput
- local dragStart
- local startPos
- dragButton.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- dragStart = input.Position
- startPos = Frame.Position
- end
- end)
- dragButton.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = false
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
- dragInput = input
- end
- end)
- RunService.RenderStepped:Connect(function()
- if dragging and dragInput then
- local delta = dragInput.Position - dragStart
- Frame.Position = UDim2.new(
- startPos.X.Scale,
- startPos.X.Offset + delta.X,
- startPos.Y.Scale,
- startPos.Y.Offset + delta.Y
- )
- end
- end)
- -- Mensagem de confirmação no console
- print("Script de Combate Automático carregado!")
- print("Instruções: Ative os checkboxes para habilitar as funções")
Advertisement
Add Comment
Please, Sign In to add comment