Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Referência ao jogador local
- local jogador = game.Players.LocalPlayer
- -- Obtém todos os filhos do objeto Points
- local points = workspace.Points:GetChildren()
- -- Variáveis para controlar o estado do auto farm e a velocidade do jogador
- local autoFarmAtivado = false
- local velocidadeJogador = 16 -- Velocidade de movimento do jogador
- -- Função para mover o jogador em direção a um ponto
- local function moverJogadorParaPonto(ponto)
- if jogador.Character then
- local humanoid = jogador.Character:FindFirstChildOfClass("Humanoid")
- if humanoid then
- humanoid:Move(Vector3.new(ponto.Position.X, jogador.Character.HumanoidRootPart.Position.Y, ponto.Position.Z))
- end
- end
- end
- -- Função para recriar a GUI
- local function criarGUI()
- local gui = jogador.PlayerGui:FindFirstChild("AutoFarmGui")
- if not gui then
- gui = Instance.new("ScreenGui")
- gui.Name = "AutoFarmGui"
- gui.Parent = jogador.PlayerGui
- else
- gui:ClearAllChildren() -- Limpar filhos existentes para evitar duplicatas
- end
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 200, 0, 200)
- frame.Position = UDim2.new(0, 10, 0, 10)
- frame.BackgroundColor3 = Color3.new(0.8, 0.8, 0.8)
- frame.BorderSizePixel = 2
- frame.BorderColor3 = Color3.new(0, 0, 0)
- frame.Parent = gui
- local titleLabel = Instance.new("TextLabel")
- titleLabel.Text = "Auto Farm"
- titleLabel.Size = UDim2.new(1, 0, 0.1, 0)
- titleLabel.Font = Enum.Font.SourceSansBold
- titleLabel.TextSize = 20
- titleLabel.Parent = frame
- local toggleButton = Instance.new("TextButton")
- toggleButton.Text = "Ativar Auto Farm"
- toggleButton.Size = UDim2.new(1, 0, 0.1, 0)
- toggleButton.Position = UDim2.new(0, 0, 0.1, 0)
- toggleButton.Parent = frame
- local speedLabel = Instance.new("TextLabel")
- speedLabel.Text = "Velocidade do Jogador"
- speedLabel.Size = UDim2.new(1, 0, 0.1, 0)
- speedLabel.Position = UDim2.new(0, 0, 0.3, 0)
- speedLabel.Parent = frame
- local speedTextBox = Instance.new("TextBox")
- speedTextBox.Text = tostring(velocidadeJogador)
- speedTextBox.Size = UDim2.new(0.6, 0, 0.1, 0)
- speedTextBox.Position = UDim2.new(0, 0, 0.4, 0)
- speedTextBox.Parent = frame
- local applySpeedButton = Instance.new("TextButton")
- applySpeedButton.Text = "Aplicar Velocidade"
- applySpeedButton.Size = UDim2.new(0.4, 0, 0.1, 0)
- applySpeedButton.Position = UDim2.new(0.6, 0, 0.4, 0)
- applySpeedButton.Parent = frame
- local stopAutoFarmButton = Instance.new("TextButton")
- stopAutoFarmButton.Text = "Parar Auto Farm"
- stopAutoFarmButton.Size = UDim2.new(1, 0, 0.1, 0)
- stopAutoFarmButton.Position = UDim2.new(0, 0, 0.6, 0)
- stopAutoFarmButton.Parent = frame
- -- Função para alternar o estado do auto farm
- local function alternarAutoFarm()
- autoFarmAtivado = not autoFarmAtivado
- toggleButton.Text = autoFarmAtivado and "Desativar Auto Farm" or "Ativar Auto Farm"
- end
- -- Função para aplicar a velocidade digitada no TextBox
- local function aplicarVelocidade()
- local novaVelocidade = tonumber(speedTextBox.Text)
- if novaVelocidade then
- velocidadeJogador = novaVelocidade
- end
- end
- -- Função para parar o auto farm
- local function pararAutoFarm()
- autoFarmAtivado = false
- toggleButton.Text = "Ativar Auto Farm"
- end
- -- Conectar as funções aos eventos adequados
- toggleButton.MouseButton1Click:Connect(alternarAutoFarm)
- applySpeedButton.MouseButton1Click:Connect(aplicarVelocidade)
- stopAutoFarmButton.MouseButton1Click:Connect(pararAutoFarm)
- end
- -- Conectar a função de criar GUI ao evento de recriar o personagem
- jogador.CharacterAdded:Connect(function()
- criarGUI()
- end)
- -- Inicialmente, criar a GUI
- criarGUI()
- -- Loop principal
- while wait(0.1) do
- if autoFarmAtivado then
- -- Verificar se ainda há pontos
- if #points > 0 then
- local pontoDesejado = points[1]
- if pontoDesejado then
- -- Mover o jogador em direção ao ponto
- moverJogadorParaPonto(pontoDesejado)
- -- Verificar a proximidade do ponto
- local distancia = (jogador.Character.HumanoidRootPart.Position - pontoDesejado.Position).Magnitude
- if distancia < 5 then
- -- Se o jogador estiver perto o suficiente, coletar o ponto
- table.remove(points, 1)
- table.insert(points, pontoDesejado) -- Adicionar o ponto de volta ao final da lista
- -- Ajustar a velocidade do jogador conforme necessário
- jogador.Character.Humanoid.WalkSpeed = velocidadeJogador
- end
- else
- -- Se todos os pontos foram alcançados, reiniciar o ciclo
- points = workspace.Points:GetChildren()
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement