Advertisement
1zxyuuki

autoraid

Sep 24th, 2024
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.84 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  3. local Character = Players.LocalPlayer.Character or Players.LocalPlayer.CharacterAdded:Wait()
  4. local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
  5.  
  6. local HPositions = {
  7. Vector3.new(25812, 1845, -3140),
  8. Vector3.new(25896, 1845, -3102),
  9. Vector3.new(25844, 1845, -3060),
  10. Vector3.new(25765, 1845, -3217),
  11. Vector3.new(25842, 1845, -3222),
  12. Vector3.new(25879, 1845, -3241),
  13. }
  14.  
  15. local waitTime = 1
  16. local teleportCFrame = CFrame.new(-4614, 2665, 1226) -- CFrame de destino após a raid
  17.  
  18. local function updateCFrame()
  19. for _, position in ipairs(HPositions) do
  20. HumanoidRootPart.CFrame = CFrame.new(position)
  21. task.wait(waitTime) -- Espera entre os movimentos
  22. end
  23. end
  24.  
  25. _G.AutoRaid = false
  26. local isInRaid = false -- Flag para verificar se estamos na raid
  27.  
  28. while true do
  29. if _G.AutoRaid and not isInRaid then
  30. -- Obter a sala
  31. local args = {
  32. [1] = {
  33. [1] = {
  34. [1] = "Raid",
  35. [2] = {
  36. [1] = "GetRoom",
  37. [2] = 4
  38. }
  39. },
  40. [2] = "\2"
  41. }
  42. }
  43.  
  44. local dataRemoteEvent = ReplicatedStorage:FindFirstChild("dataRemoteEvent")
  45. if dataRemoteEvent then
  46. dataRemoteEvent:FireServer(unpack(args))
  47. print("Sala obtida com sucesso.")
  48. else
  49. warn("dataRemoteEvent não encontrado!")
  50. end
  51. task.wait(0.2)
  52.  
  53. -- Selecionar o mapa
  54. local mapArgs = {
  55. [1] = {
  56. [1] = {
  57. [1] = "Raid",
  58. [2] = {
  59. [1] = "SelectMap",
  60. [2] = 4,
  61. [3] = {
  62. ["Name"] = "Piece",
  63. ["Image"] = "rbxassetid://18822946469"
  64. }
  65. }
  66. },
  67. [2] = "\2"
  68. }
  69. }
  70. if dataRemoteEvent then
  71. dataRemoteEvent:FireServer(unpack(mapArgs))
  72. print("Mapa selecionado com sucesso.")
  73. else
  74. warn("dataRemoteEvent não encontrado!")
  75. end
  76. task.wait(0.5)
  77.  
  78. -- Iniciar o raid
  79. local Sargs = {
  80. [1] = {
  81. [1] = {
  82. [1] = "StartRaid",
  83. [2] = {
  84. [1] = 4
  85. }
  86. },
  87. [2] = "\2"
  88. }
  89. }
  90.  
  91. if dataRemoteEvent then
  92. print("Tentando iniciar o raid...")
  93. dataRemoteEvent:FireServer(unpack(Sargs))
  94.  
  95. -- Verificar se a chamada para iniciar a raid foi bem-sucedida
  96. task.wait(0.5) -- Espera um pouco para a resposta
  97. if not isInRaid then
  98. isInRaid = true -- Definindo que agora estamos na raid
  99. print("Raid iniciada com sucesso.")
  100. else
  101. warn("Falha ao iniciar a raid.")
  102. end
  103. else
  104. warn("dataRemoteEvent não encontrado!")
  105. end
  106.  
  107. -- Atualizar CFrame se ainda estiver na torre após 0.3 segundos
  108. local startTime = tick() -- Hora de início da atualização do CFrame
  109. while isInRaid do
  110. task.wait(0.3) -- Espera 0.3 segundos
  111.  
  112. -- Verifica se ainda estamos na raid
  113. local enemies = workspace.Enemies:GetChildren()
  114. local hasEnemy = false
  115. for _, enemy in ipairs(enemies) do
  116. if enemy:GetAttribute("Parent") == "PieceRaid" then
  117. hasEnemy = true
  118. break
  119. end
  120. end
  121.  
  122. -- Se não houver inimigos, atualiza o CFrame
  123. if hasEnemy then
  124. updateCFrame()
  125. else
  126. print("Saímos da raid. Cancelando teleporte.")
  127. isInRaid = false -- Se não há inimigos, saia da raid
  128. end
  129.  
  130. -- Cancela o teleporte se estiver na torre por mais de 0.3 segundos
  131. if tick() - startTime >= 0.3 then
  132. if isInRaid then
  133. updateCFrame() -- Reexecuta a função de CFrame após 0.3 segundos
  134. startTime = tick() -- Reseta o tempo de início
  135. end
  136. end
  137. end
  138.  
  139. -- Teleporte para o CFrame especificado após terminar a raid
  140. if not isInRaid then
  141. HumanoidRootPart.CFrame = teleportCFrame -- Teleporta para o CFrame desejado
  142. print("Teleportando para a posição após a raid.")
  143. end
  144.  
  145. task.wait(4) -- Tempo de espera após completar um ciclo
  146. else
  147. task.wait(1) -- Espera um segundo se AutoRaid estiver desativado
  148. end
  149. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement