Advertisement
arwaawfwa

Untitled

Jan 5th, 2024
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.00 KB | None | 0 0
  1. -- Referência ao jogador local
  2. local jogador = game.Players.LocalPlayer
  3.  
  4. -- Obtém todos os filhos do objeto Points
  5. local points = workspace.Points:GetChildren()
  6.  
  7. -- Variáveis para controlar o estado do auto farm e a velocidade do jogador
  8. local autoFarmAtivado = false
  9. local velocidadeJogador = 16 -- Velocidade de movimento do jogador
  10.  
  11. -- Função para mover o jogador em direção a um ponto
  12. local function moverJogadorParaPonto(ponto)
  13. if jogador.Character then
  14. local humanoid = jogador.Character:FindFirstChildOfClass("Humanoid")
  15. if humanoid then
  16. humanoid:Move(Vector3.new(ponto.Position.X, jogador.Character.HumanoidRootPart.Position.Y, ponto.Position.Z))
  17. end
  18. end
  19. end
  20.  
  21. -- Função para recriar a GUI
  22. local function criarGUI()
  23. local gui = jogador.PlayerGui:FindFirstChild("AutoFarmGui")
  24. if not gui then
  25. gui = Instance.new("ScreenGui")
  26. gui.Name = "AutoFarmGui"
  27. gui.Parent = jogador.PlayerGui
  28. else
  29. gui:ClearAllChildren() -- Limpar filhos existentes para evitar duplicatas
  30. end
  31.  
  32. local frame = Instance.new("Frame")
  33. frame.Size = UDim2.new(0, 200, 0, 200)
  34. frame.Position = UDim2.new(0, 10, 0, 10)
  35. frame.BackgroundColor3 = Color3.new(0.8, 0.8, 0.8)
  36. frame.BorderSizePixel = 2
  37. frame.BorderColor3 = Color3.new(0, 0, 0)
  38. frame.Parent = gui
  39.  
  40. local titleLabel = Instance.new("TextLabel")
  41. titleLabel.Text = "Auto Farm"
  42. titleLabel.Size = UDim2.new(1, 0, 0.1, 0)
  43. titleLabel.Font = Enum.Font.SourceSansBold
  44. titleLabel.TextSize = 20
  45. titleLabel.Parent = frame
  46.  
  47. local toggleButton = Instance.new("TextButton")
  48. toggleButton.Text = "Ativar Auto Farm"
  49. toggleButton.Size = UDim2.new(1, 0, 0.1, 0)
  50. toggleButton.Position = UDim2.new(0, 0, 0.1, 0)
  51. toggleButton.Parent = frame
  52.  
  53. local speedLabel = Instance.new("TextLabel")
  54. speedLabel.Text = "Velocidade do Jogador"
  55. speedLabel.Size = UDim2.new(1, 0, 0.1, 0)
  56. speedLabel.Position = UDim2.new(0, 0, 0.3, 0)
  57. speedLabel.Parent = frame
  58.  
  59. local speedTextBox = Instance.new("TextBox")
  60. speedTextBox.Text = tostring(velocidadeJogador)
  61. speedTextBox.Size = UDim2.new(0.6, 0, 0.1, 0)
  62. speedTextBox.Position = UDim2.new(0, 0, 0.4, 0)
  63. speedTextBox.Parent = frame
  64.  
  65. local applySpeedButton = Instance.new("TextButton")
  66. applySpeedButton.Text = "Aplicar Velocidade"
  67. applySpeedButton.Size = UDim2.new(0.4, 0, 0.1, 0)
  68. applySpeedButton.Position = UDim2.new(0.6, 0, 0.4, 0)
  69. applySpeedButton.Parent = frame
  70.  
  71. local stopAutoFarmButton = Instance.new("TextButton")
  72. stopAutoFarmButton.Text = "Parar Auto Farm"
  73. stopAutoFarmButton.Size = UDim2.new(1, 0, 0.1, 0)
  74. stopAutoFarmButton.Position = UDim2.new(0, 0, 0.6, 0)
  75. stopAutoFarmButton.Parent = frame
  76.  
  77. -- Função para alternar o estado do auto farm
  78. local function alternarAutoFarm()
  79. autoFarmAtivado = not autoFarmAtivado
  80. toggleButton.Text = autoFarmAtivado and "Desativar Auto Farm" or "Ativar Auto Farm"
  81. end
  82.  
  83. -- Função para aplicar a velocidade digitada no TextBox
  84. local function aplicarVelocidade()
  85. local novaVelocidade = tonumber(speedTextBox.Text)
  86. if novaVelocidade then
  87. velocidadeJogador = novaVelocidade
  88. end
  89. end
  90.  
  91. -- Função para parar o auto farm
  92. local function pararAutoFarm()
  93. autoFarmAtivado = false
  94. toggleButton.Text = "Ativar Auto Farm"
  95. end
  96.  
  97. -- Conectar as funções aos eventos adequados
  98. toggleButton.MouseButton1Click:Connect(alternarAutoFarm)
  99. applySpeedButton.MouseButton1Click:Connect(aplicarVelocidade)
  100. stopAutoFarmButton.MouseButton1Click:Connect(pararAutoFarm)
  101. end
  102.  
  103. -- Conectar a função de criar GUI ao evento de recriar o personagem
  104. jogador.CharacterAdded:Connect(function()
  105. criarGUI()
  106. end)
  107.  
  108. -- Inicialmente, criar a GUI
  109. criarGUI()
  110.  
  111. -- Loop principal
  112. while wait(0.1) do
  113. if autoFarmAtivado then
  114. -- Verificar se ainda há pontos
  115. if #points > 0 then
  116. local pontoDesejado = points[1]
  117. if pontoDesejado then
  118. -- Mover o jogador em direção ao ponto
  119. moverJogadorParaPonto(pontoDesejado)
  120.  
  121. -- Verificar a proximidade do ponto
  122. local distancia = (jogador.Character.HumanoidRootPart.Position - pontoDesejado.Position).Magnitude
  123. if distancia < 5 then
  124. -- Se o jogador estiver perto o suficiente, coletar o ponto
  125. table.remove(points, 1)
  126. table.insert(points, pontoDesejado) -- Adicionar o ponto de volta ao final da lista
  127.  
  128. -- Ajustar a velocidade do jogador conforme necessário
  129. jogador.Character.Humanoid.WalkSpeed = velocidadeJogador
  130. end
  131. else
  132. -- Se todos os pontos foram alcançados, reiniciar o ciclo
  133. points = workspace.Points:GetChildren()
  134. end
  135. end
  136. end
  137. end
  138.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement