Advertisement
Freshbloodb

Untitled

Nov 29th, 2024
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.42 KB | None | 0 0
  1. -- Servicios
  2. local Players = game:GetService("Players")
  3. local RunService = game:GetService("RunService")
  4. local TweenService = game:GetService("TweenService")
  5. local UserInputService = game:GetService("UserInputService")
  6.  
  7. -- Variables globales
  8. _G.Ancho = _G.Ancho or 6
  9. _G.Altura = _G.Altura or 10
  10. _G.enablecuadrohit = _G.enablecuadrohit or false
  11. _G.EnableLookatplayerclosset = _G.EnableLookatplayerclosset or true
  12. _G.PerseguirUsuarioNivel = _G.PerseguirUsuarioNivel or 0 -- 0: Desactivado, 1: Normal, 2: Avanzado
  13. _G.EnableTeleportUser = _G.EnableTeleportUser or false
  14. _G.CHARACTER_TELEPORT_DISTANCE = 20
  15. _G.BOMB_TRANSFER_TIMEOUT = 0.5
  16. _G.RE_TELEPORT_DELAY = 10
  17.  
  18. -- Variables locales
  19. local localPlayer = Players.LocalPlayer
  20. local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
  21. local humanoid = character:WaitForChild("Humanoid")
  22. local rootPart = character:WaitForChild("HumanoidRootPart")
  23. local boxes = {}
  24.  
  25. -- Funciones auxiliares
  26. local function playerHasItems(player)
  27. local character = player.Character
  28. if not character then return false end
  29.  
  30. if character:FindFirstChildOfClass("Tool") then
  31. return true
  32. end
  33.  
  34. local backpack = player:FindFirstChildOfClass("Backpack")
  35. if backpack and #backpack:GetChildren() > 0 then
  36. return true
  37. end
  38.  
  39. return false
  40. end
  41.  
  42. local function getClosestPlayer()
  43. local closestPlayer = nil
  44. local shortestDistance = math.huge
  45.  
  46. for _, player in ipairs(Players:GetPlayers()) do
  47. if player ~= localPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
  48. local targetHumanoid = player.Character:FindFirstChild("Humanoid")
  49.  
  50. if targetHumanoid and targetHumanoid.Health > 0 then
  51. local distance = (rootPart.Position - player.Character.HumanoidRootPart.Position).Magnitude
  52. if distance < shortestDistance then
  53. shortestDistance = distance
  54. closestPlayer = player
  55. end
  56. end
  57. end
  58. end
  59.  
  60. return closestPlayer, shortestDistance
  61. end
  62.  
  63. -- Funciones de creación y actualización de cajas
  64. local function createAnimatedBox(player)
  65. if boxes[player] then return end
  66.  
  67. local box = Instance.new("Part")
  68. box.Anchored = true
  69. box.CanCollide = false
  70. box.Transparency = 0.5
  71. box.Color = Color3.new(1, 0, 0)
  72. box.Size = Vector3.new(0, 0, 0)
  73. box.Parent = workspace
  74. boxes[player] = box
  75.  
  76. local targetSize = Vector3.new(_G.Ancho, _G.Altura, _G.Ancho)
  77. local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Quart, Enum.EasingDirection.Out)
  78. local sizeTween = TweenService:Create(box, tweenInfo, {Size = targetSize})
  79.  
  80. sizeTween:Play()
  81.  
  82. box.CFrame = player.Character.HumanoidRootPart.CFrame
  83. end
  84.  
  85. local function updateBoxes()
  86. for _, player in ipairs(Players:GetPlayers()) do
  87. if player ~= localPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
  88. if _G.enablecuadrohit then
  89. if playerHasItems(player) then
  90. if not boxes[player] then
  91. createAnimatedBox(player)
  92. end
  93. boxes[player].CFrame = player.Character.HumanoidRootPart.CFrame
  94. else
  95. if boxes[player] then
  96. boxes[player]:Destroy()
  97. boxes[player] = nil
  98. end
  99. end
  100. else
  101. if boxes[player] then
  102. boxes[player]:Destroy()
  103. boxes[player] = nil
  104. end
  105. end
  106. end
  107. end
  108. end
  109.  
  110. -- Funciones de movimiento del jugador
  111. local function lookAtClosestPlayer()
  112. if not _G.EnableLookatplayerclosset then return end
  113.  
  114. local closestPlayer = getClosestPlayer()
  115.  
  116. if closestPlayer and playerHasItems(localPlayer) then
  117. local targetCharacter = closestPlayer.Character
  118. if targetCharacter then
  119. local targetHumanoidRootPart = targetCharacter:FindFirstChild("HumanoidRootPart")
  120. if targetHumanoidRootPart then
  121. local localPosition = localPlayer.Character.HumanoidRootPart.Position
  122. local targetPosition = targetHumanoidRootPart.Position
  123. targetPosition = Vector3.new(targetPosition.X, localPosition.Y, targetPosition.Z)
  124. local direction = (targetPosition - localPosition).unit
  125. localPlayer.Character.HumanoidRootPart.CFrame = CFrame.lookAt(localPosition, localPosition + direction)
  126. end
  127. end
  128. end
  129. end
  130.  
  131. local function detectHoleOrGap(position)
  132. local rayOrigin = position + Vector3.new(0, 5, 0)
  133. local rayDirection = Vector3.new(0, -10, 0)
  134. local ray = Ray.new(rayOrigin, rayDirection)
  135.  
  136. local hitPart = workspace:FindPartOnRay(ray, character)
  137.  
  138. return not hitPart
  139. end
  140.  
  141. local function moveToPlayerNormal(targetPlayer)
  142. if not targetPlayer or not targetPlayer.Character then return end
  143.  
  144. local targetPosition = targetPlayer.Character.HumanoidRootPart.Position
  145. humanoid:MoveTo(targetPosition)
  146. end
  147.  
  148. local function moveToPlayerAdvanced(targetPlayer)
  149. if not targetPlayer or not targetPlayer.Character then return end
  150.  
  151. local targetPosition = targetPlayer.Character.HumanoidRootPart.Position
  152. local direction = (targetPosition - rootPart.Position).unit
  153. local nextPosition = rootPart.Position + direction * 5
  154.  
  155. if detectHoleOrGap(nextPosition) then
  156. local alternateDirections = {
  157. Vector3.new(5, 0, 0),
  158. Vector3.new(-5, 0, 0),
  159. Vector3.new(0, 0, 5),
  160. Vector3.new(0, 0, -5)
  161. }
  162.  
  163. for _, offset in ipairs(alternateDirections) do
  164. local testPosition = rootPart.Position + offset
  165. if not detectHoleOrGap(testPosition) then
  166. humanoid:MoveTo(testPosition)
  167. return
  168. end
  169. end
  170. else
  171. humanoid:MoveTo(targetPosition)
  172. end
  173. end
  174.  
  175. -- Funciones de teletransportación
  176. local lastBombTransferTime = {}
  177. local lastTeleportTime = {}
  178.  
  179. local function CanTeleportToPlayer(player)
  180. local currentTime = tick()
  181. if lastTeleportTime[player.UserId] and currentTime - lastTeleportTime[player.UserId] < _G.RE_TELEPORT_DELAY then
  182. return false
  183. end
  184. return true
  185. end
  186.  
  187. local function TeleportToPlayer(targetPlayer)
  188. local Character = localPlayer.Character
  189. if not Character then return end
  190.  
  191. local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
  192. if not HumanoidRootPart then return end
  193.  
  194. local targetCharacter = targetPlayer.Character
  195. if not targetCharacter then return end
  196.  
  197. local targetRootPart = targetCharacter:FindFirstChild("HumanoidRootPart")
  198. if not targetRootPart then return end
  199.  
  200. local forwardPosition = targetRootPart.CFrame:PointToWorldSpace(Vector3.new(0, 0, -3))
  201. HumanoidRootPart.CFrame = CFrame.new(forwardPosition, targetRootPart.Position)
  202.  
  203. local RightHand = Character:FindFirstChild("RightHand") or Character:FindFirstChild("Right Arm")
  204. if RightHand then
  205. RightHand.CFrame = targetRootPart.CFrame * CFrame.new(-1, 0, 0)
  206. end
  207.  
  208. lastTeleportTime[targetPlayer.UserId] = tick()
  209. end
  210.  
  211. local function TeleportCharacterToClosestPlayer()
  212. local Character = localPlayer.Character
  213. if not Character then return end
  214.  
  215. local Bomb = Character:FindFirstChildOfClass("Tool")
  216. if not Bomb or Bomb.Name ~= "Bomb" then return end
  217.  
  218. local closestPlayer, closestDistance = getClosestPlayer()
  219. if not closestPlayer or closestDistance > _G.CHARACTER_TELEPORT_DISTANCE then return end
  220.  
  221. if not CanTeleportToPlayer(closestPlayer) then return end
  222.  
  223. local currentTime = tick()
  224.  
  225. if lastBombTransferTime[closestPlayer.UserId] and currentTime - lastBombTransferTime[closestPlayer.UserId] > _G.BOMB_TRANSFER_TIMEOUT then
  226. print("Teletransportación cancelada: No se pasó la bomba a", closestPlayer.Name)
  227. lastTeleportTime[closestPlayer.UserId] = currentTime
  228. return
  229. end
  230.  
  231. TeleportToPlayer(closestPlayer)
  232.  
  233. if Bomb:FindFirstChild("Handle") then
  234. Bomb.Handle.CFrame = closestPlayer.Character.HumanoidRootPart.CFrame
  235. lastBombTransferTime[closestPlayer.UserId] = currentTime
  236. print("Bomba pasada a:", closestPlayer.Name)
  237. end
  238. end
  239.  
  240. -- Creación de la interfaz de usuario
  241. local ScreenGui = Instance.new("ScreenGui")
  242. ScreenGui.Name = "CuadroEnemyBombMenu"
  243. ScreenGui.ResetOnSpawn = false
  244. ScreenGui.Parent = localPlayer:WaitForChild("PlayerGui")
  245.  
  246. local function createButton(text, position)
  247. local button = Instance.new("TextButton")
  248. button.Size = UDim2.new(0, 200, 0, 50)
  249. button.Position = position
  250. button.Text = text
  251. button.Font = Enum.Font.SourceSansBold
  252. button.TextColor3 = Color3.new(1, 1, 1)
  253. button.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
  254. button.BorderSizePixel = 0
  255. button.Parent = ScreenGui
  256.  
  257. local corner = Instance.new("UICorner")
  258. corner.CornerRadius = UDim.new(0, 10)
  259. corner.Parent = button
  260.  
  261. return button
  262. end
  263.  
  264. local function createInputBox(text, position)
  265. local frame = Instance.new("Frame")
  266. frame.Size = UDim2.new(0, 200, 0, 80)
  267. frame.Position = position
  268. frame.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
  269. frame.BorderSizePixel = 0
  270. frame.Parent = ScreenGui
  271.  
  272. local corner = Instance.new("UICorner")
  273. corner.CornerRadius = UDim.new(0, 10)
  274. corner.Parent = frame
  275.  
  276. local label = Instance.new("TextLabel")
  277. label.Size = UDim2.new(1, 0, 0, 30)
  278. label.Position = UDim2.new(0, 0, 0, 0)
  279. label.Text = text
  280. label.Font = Enum.Font.SourceSansBold
  281. label.TextColor3 = Color3.new(1, 1, 1)
  282. label.BackgroundTransparency = 1
  283. label.Parent = frame
  284.  
  285. local input = Instance.new("TextBox")
  286. input.Size = UDim2.new(0.9, 0, 0, 30)
  287. input.Position = UDim2.new(0.05, 0, 0.5, 0)
  288. input.Font = Enum.Font.SourceSans
  289. input.TextColor3 = Color3.new(0, 0, 0)
  290. input.BackgroundColor3 = Color3.new(1, 1, 1)
  291. input.Parent = frame
  292.  
  293. local inputCorner = Instance.new("UICorner")
  294. inputCorner.CornerRadius = UDim.new(0, 5)
  295. inputCorner.Parent = input
  296.  
  297. return input
  298. end
  299.  
  300. local menuButton = createButton("Abrir Menú", UDim2.new(1, -220, 1, -70))
  301. local menuFrame = Instance.new("Frame")
  302. menuFrame.Size = UDim2.new(0, 220, 0, 300)
  303. menuFrame.Position = UDim2.new(1, -240, 0.5, -150)
  304. menuFrame.BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)
  305. menuFrame.BorderSizePixel = 0
  306. menuFrame.Visible = false
  307. menuFrame.Parent = ScreenGui
  308.  
  309. local menuCorner = Instance.new("UICorner")
  310. menuCorner.CornerRadius = UDim.new(0, 10)
  311. menuCorner.Parent = menuFrame
  312.  
  313. local anchoInput = createInputBox("Ancho:", UDim2.new(0, 10, 0, 10))
  314. anchoInput.Parent = menuFrame
  315.  
  316. local alturaInput = createInputBox("Altura:", UDim2.new(0, 10, 0, 100))
  317. alturaInput.Parent = menuFrame
  318.  
  319. local enableCuadroHitButton = createButton("Enable Cuadro Hit: OFF", UDim2.new(0, 10, 0, 190))
  320. enableCuadroHitButton.Parent = menuFrame
  321.  
  322. local enableLookAtPlayerButton = createButton("Enable Look at Player: ON", UDim2.new(0, 10, 0, 250))
  323. enableLookAtPlayerButton.Parent = menuFrame
  324.  
  325. local perseguirUsuarioButton = createButton("Perseguir Usuario: OFF", UDim2.new(0, 10, 0, 310))
  326. perseguirUsuarioButton.Parent = menuFrame
  327.  
  328. local enableTeleportUserButton = createButton("Enable Teleport User: OFF", UDim2.new(0, 10, 0, 370))
  329. enableTeleportUserButton.Parent = menuFrame
  330.  
  331. -- Funciones de la interfaz de usuario
  332. local function toggleMenu()
  333. menuFrame.Visible = not menuFrame.Visible
  334. end
  335.  
  336. local function updateAnchoAltura()
  337. _G.Ancho = tonumber(anchoInput.Text) or _G.Ancho
  338. _G.Altura = tonumber(alturaInput.Text) or _G.Altura
  339. updateBoxes()
  340. end
  341.  
  342. local function toggleEnableCuadroHit()
  343. _G.enablecuadrohit = not _G.enablecuadrohit
  344. enableCuadroHitButton.Text = "Enable Cuadro Hit: " .. (_G.enablecuadrohit and "ON" or "OFF")
  345. updateBoxes()
  346. end
  347.  
  348. local function toggleEnableLookAtPlayer()
  349. _G.EnableLookatplayerclosset = not _G.EnableLookatplayerclosset
  350. enableLookAtPlayerButton.Text = "Enable Look at Player: " .. (_G.EnableLookatplayerclosset and "ON" or "OFF")
  351. end
  352.  
  353. local function togglePerseguirUsuario()
  354. _G.PerseguirUsuarioNivel = (_G.PerseguirUsuarioNivel + 1) % 3
  355. if _G.PerseguirUsuarioNivel == 0 then
  356. perseguirUsuarioButton.Text = "Perseguir Usuario: OFF"
  357. perseguirUsuarioButton.BackgroundColor3 = Color3.new(1, 0, 0) -- Rojo
  358. elseif _G.PerseguirUsuarioNivel == 1 then
  359. perseguirUsuarioButton.Text = "Perseguir Usuario: Normal"
  360. perseguirUsuarioButton.BackgroundColor3 = Color3.new(0, 1, 0) -- Verde
  361. else
  362. perseguirUsuarioButton.Text = "Perseguir Usuario: Avanzado"
  363. perseguirUsuarioButton.BackgroundColor3 = Color3.new(1, 1, 0) -- Amarillo
  364. end
  365. end
  366.  
  367. local function toggleEnableTeleportUser()
  368. _G.EnableTeleportUser = not _G.EnableTeleportUser
  369. enableTeleportUserButton.Text = "Enable Teleport User: " .. (_G.EnableTeleportUser and "ON" or "OFF")
  370. if _G.EnableTeleportUser then
  371. loadstring(game:HttpGet("https://pastebin.com/raw/R9Av86Wm"))()
  372. end
  373. end
  374.  
  375. -- Conexiones de eventos de la interfaz de usuario
  376. menuButton.MouseButton1Click:Connect(toggleMenu)
  377. anchoInput.FocusLost:Connect(updateAnchoAltura)
  378. alturaInput.FocusLost:Connect(updateAnchoAltura)
  379. enableCuadroHitButton.MouseButton1Click:Connect(toggleEnableCuadroHit)
  380. enableLookAtPlayerButton.MouseButton1Click:Connect(toggleEnableLookAtPlayer)
  381. perseguirUsuarioButton.MouseButton1Click:Connect(togglePerseguirUsuario)
  382. enableTeleportUserButton.MouseButton1Click:Connect(toggleEnableTeleportUser)
  383.  
  384. -- Bucle principal
  385. RunService.Heartbeat:Connect(function()
  386. updateBoxes()
  387. if _G.EnableLookatplayerclosset and playerHasItems(localPlayer) then
  388. lookAtClosestPlayer()
  389. end
  390. if _G.PerseguirUsuarioNivel > 0 and playerHasItems(localPlayer) then
  391. local closestPlayer = getClosestPlayer()
  392. if closestPlayer then
  393. if _G.PerseguirUsuarioNivel == 1 then
  394. moveToPlayerNormal(closestPlayer)
  395. else
  396. moveToPlayerAdvanced(closestPlayer)
  397. end
  398. end
  399. end
  400. if _G.EnableTeleportUser then
  401. TeleportCharacterToClosestPlayer()
  402. end
  403. end)
  404.  
  405. -- Manejar el respawn del jugador
  406. localPlayer.CharacterAdded:Connect(function(newCharacter)
  407. character = newCharacter
  408. humanoid = newCharacter:WaitForChild("Humanoid")
  409. rootPart = newCharacter:WaitForChild("HumanoidRootPart")
  410. end)
  411.  
  412. -- Inicialización
  413. anchoInput.Text = tostring(_G.Ancho)
  414. alturaInput.Text = tostring(_G.Altura)
  415. enableCuadroHitButton.Text = "Enable Cuadro Hit: " .. (_G.enablecuadrohit and "ON" or "OFF")
  416. enableLookAtPlayerButton.Text = "Enable Look at Player: " .. (_G.EnableLookatplayerclosset and "ON" or "OFF")
  417. perseguirUsuarioButton.Text = "Perseguir Usuario: " .. (_G.PerseguirUsuarioNivel == 0 and "OFF" or _G.PerseguirUsuarioNivel == 1 and "Normal" or "Avanzado")
  418. perseguirUsuarioButton.BackgroundColor3 = _G.PerseguirUsuarioNivel == 0 and Color3.new(1, 0, 0) or _G.PerseguirUsuarioNivel == 1 and Color3.new(0, 1, 0) or Color3.new(1, 1, 0)
  419. enableTeleportUserButton.Text = "Enable Teleport User: " .. (_G.EnableTeleportUser and "ON" or "OFF")
  420.  
  421. print("Script inicializado correctamente.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement