Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Servicios
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- local TweenService = game:GetService("TweenService")
- local UserInputService = game:GetService("UserInputService")
- -- Variables globales
- _G.Ancho = _G.Ancho or 6
- _G.Altura = _G.Altura or 10
- _G.enablecuadrohit = _G.enablecuadrohit or false
- _G.EnableLookatplayerclosset = _G.EnableLookatplayerclosset or true
- _G.PerseguirUsuarioNivel = _G.PerseguirUsuarioNivel or 0 -- 0: Desactivado, 1: Normal, 2: Avanzado
- _G.EnableTeleportUser = _G.EnableTeleportUser or false
- _G.CHARACTER_TELEPORT_DISTANCE = 20
- _G.BOMB_TRANSFER_TIMEOUT = 0.5
- _G.RE_TELEPORT_DELAY = 10
- -- Variables locales
- local localPlayer = Players.LocalPlayer
- local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
- local humanoid = character:WaitForChild("Humanoid")
- local rootPart = character:WaitForChild("HumanoidRootPart")
- local boxes = {}
- -- Funciones auxiliares
- local function playerHasItems(player)
- local character = player.Character
- if not character then return false end
- if character:FindFirstChildOfClass("Tool") then
- return true
- end
- local backpack = player:FindFirstChildOfClass("Backpack")
- if backpack and #backpack:GetChildren() > 0 then
- return true
- end
- return false
- end
- local function getClosestPlayer()
- local closestPlayer = nil
- local shortestDistance = math.huge
- for _, player in ipairs(Players:GetPlayers()) do
- if player ~= localPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
- local targetHumanoid = player.Character:FindFirstChild("Humanoid")
- if targetHumanoid and targetHumanoid.Health > 0 then
- local distance = (rootPart.Position - player.Character.HumanoidRootPart.Position).Magnitude
- if distance < shortestDistance then
- shortestDistance = distance
- closestPlayer = player
- end
- end
- end
- end
- return closestPlayer, shortestDistance
- end
- -- Funciones de creación y actualización de cajas
- local function createAnimatedBox(player)
- if boxes[player] then return end
- local box = Instance.new("Part")
- box.Anchored = true
- box.CanCollide = false
- box.Transparency = 0.5
- box.Color = Color3.new(1, 0, 0)
- box.Size = Vector3.new(0, 0, 0)
- box.Parent = workspace
- boxes[player] = box
- local targetSize = Vector3.new(_G.Ancho, _G.Altura, _G.Ancho)
- local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Quart, Enum.EasingDirection.Out)
- local sizeTween = TweenService:Create(box, tweenInfo, {Size = targetSize})
- sizeTween:Play()
- box.CFrame = player.Character.HumanoidRootPart.CFrame
- end
- local function updateBoxes()
- for _, player in ipairs(Players:GetPlayers()) do
- if player ~= localPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
- if _G.enablecuadrohit then
- if playerHasItems(player) then
- if not boxes[player] then
- createAnimatedBox(player)
- end
- boxes[player].CFrame = player.Character.HumanoidRootPart.CFrame
- else
- if boxes[player] then
- boxes[player]:Destroy()
- boxes[player] = nil
- end
- end
- else
- if boxes[player] then
- boxes[player]:Destroy()
- boxes[player] = nil
- end
- end
- end
- end
- end
- -- Funciones de movimiento del jugador
- local function lookAtClosestPlayer()
- if not _G.EnableLookatplayerclosset then return end
- local closestPlayer = getClosestPlayer()
- if closestPlayer and playerHasItems(localPlayer) then
- local targetCharacter = closestPlayer.Character
- if targetCharacter then
- local targetHumanoidRootPart = targetCharacter:FindFirstChild("HumanoidRootPart")
- if targetHumanoidRootPart then
- local localPosition = localPlayer.Character.HumanoidRootPart.Position
- local targetPosition = targetHumanoidRootPart.Position
- targetPosition = Vector3.new(targetPosition.X, localPosition.Y, targetPosition.Z)
- local direction = (targetPosition - localPosition).unit
- localPlayer.Character.HumanoidRootPart.CFrame = CFrame.lookAt(localPosition, localPosition + direction)
- end
- end
- end
- end
- local function detectHoleOrGap(position)
- local rayOrigin = position + Vector3.new(0, 5, 0)
- local rayDirection = Vector3.new(0, -10, 0)
- local ray = Ray.new(rayOrigin, rayDirection)
- local hitPart = workspace:FindPartOnRay(ray, character)
- return not hitPart
- end
- local function moveToPlayerNormal(targetPlayer)
- if not targetPlayer or not targetPlayer.Character then return end
- local targetPosition = targetPlayer.Character.HumanoidRootPart.Position
- humanoid:MoveTo(targetPosition)
- end
- local function moveToPlayerAdvanced(targetPlayer)
- if not targetPlayer or not targetPlayer.Character then return end
- local targetPosition = targetPlayer.Character.HumanoidRootPart.Position
- local direction = (targetPosition - rootPart.Position).unit
- local nextPosition = rootPart.Position + direction * 5
- if detectHoleOrGap(nextPosition) then
- local alternateDirections = {
- Vector3.new(5, 0, 0),
- Vector3.new(-5, 0, 0),
- Vector3.new(0, 0, 5),
- Vector3.new(0, 0, -5)
- }
- for _, offset in ipairs(alternateDirections) do
- local testPosition = rootPart.Position + offset
- if not detectHoleOrGap(testPosition) then
- humanoid:MoveTo(testPosition)
- return
- end
- end
- else
- humanoid:MoveTo(targetPosition)
- end
- end
- -- Funciones de teletransportación
- local lastBombTransferTime = {}
- local lastTeleportTime = {}
- local function CanTeleportToPlayer(player)
- local currentTime = tick()
- if lastTeleportTime[player.UserId] and currentTime - lastTeleportTime[player.UserId] < _G.RE_TELEPORT_DELAY then
- return false
- end
- return true
- end
- local function TeleportToPlayer(targetPlayer)
- local Character = localPlayer.Character
- if not Character then return end
- local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
- if not HumanoidRootPart then return end
- local targetCharacter = targetPlayer.Character
- if not targetCharacter then return end
- local targetRootPart = targetCharacter:FindFirstChild("HumanoidRootPart")
- if not targetRootPart then return end
- local forwardPosition = targetRootPart.CFrame:PointToWorldSpace(Vector3.new(0, 0, -3))
- HumanoidRootPart.CFrame = CFrame.new(forwardPosition, targetRootPart.Position)
- local RightHand = Character:FindFirstChild("RightHand") or Character:FindFirstChild("Right Arm")
- if RightHand then
- RightHand.CFrame = targetRootPart.CFrame * CFrame.new(-1, 0, 0)
- end
- lastTeleportTime[targetPlayer.UserId] = tick()
- end
- local function TeleportCharacterToClosestPlayer()
- local Character = localPlayer.Character
- if not Character then return end
- local Bomb = Character:FindFirstChildOfClass("Tool")
- if not Bomb or Bomb.Name ~= "Bomb" then return end
- local closestPlayer, closestDistance = getClosestPlayer()
- if not closestPlayer or closestDistance > _G.CHARACTER_TELEPORT_DISTANCE then return end
- if not CanTeleportToPlayer(closestPlayer) then return end
- local currentTime = tick()
- if lastBombTransferTime[closestPlayer.UserId] and currentTime - lastBombTransferTime[closestPlayer.UserId] > _G.BOMB_TRANSFER_TIMEOUT then
- print("Teletransportación cancelada: No se pasó la bomba a", closestPlayer.Name)
- lastTeleportTime[closestPlayer.UserId] = currentTime
- return
- end
- TeleportToPlayer(closestPlayer)
- if Bomb:FindFirstChild("Handle") then
- Bomb.Handle.CFrame = closestPlayer.Character.HumanoidRootPart.CFrame
- lastBombTransferTime[closestPlayer.UserId] = currentTime
- print("Bomba pasada a:", closestPlayer.Name)
- end
- end
- -- Creación de la interfaz de usuario
- local ScreenGui = Instance.new("ScreenGui")
- ScreenGui.Name = "CuadroEnemyBombMenu"
- ScreenGui.ResetOnSpawn = false
- ScreenGui.Parent = localPlayer:WaitForChild("PlayerGui")
- local function createButton(text, position)
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(0, 200, 0, 50)
- button.Position = position
- button.Text = text
- button.Font = Enum.Font.SourceSansBold
- button.TextColor3 = Color3.new(1, 1, 1)
- button.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
- button.BorderSizePixel = 0
- button.Parent = ScreenGui
- local corner = Instance.new("UICorner")
- corner.CornerRadius = UDim.new(0, 10)
- corner.Parent = button
- return button
- end
- local function createInputBox(text, position)
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 200, 0, 80)
- frame.Position = position
- frame.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
- frame.BorderSizePixel = 0
- frame.Parent = ScreenGui
- local corner = Instance.new("UICorner")
- corner.CornerRadius = UDim.new(0, 10)
- corner.Parent = frame
- local label = Instance.new("TextLabel")
- label.Size = UDim2.new(1, 0, 0, 30)
- label.Position = UDim2.new(0, 0, 0, 0)
- label.Text = text
- label.Font = Enum.Font.SourceSansBold
- label.TextColor3 = Color3.new(1, 1, 1)
- label.BackgroundTransparency = 1
- label.Parent = frame
- local input = Instance.new("TextBox")
- input.Size = UDim2.new(0.9, 0, 0, 30)
- input.Position = UDim2.new(0.05, 0, 0.5, 0)
- input.Font = Enum.Font.SourceSans
- input.TextColor3 = Color3.new(0, 0, 0)
- input.BackgroundColor3 = Color3.new(1, 1, 1)
- input.Parent = frame
- local inputCorner = Instance.new("UICorner")
- inputCorner.CornerRadius = UDim.new(0, 5)
- inputCorner.Parent = input
- return input
- end
- local menuButton = createButton("Abrir Menú", UDim2.new(1, -220, 1, -70))
- local menuFrame = Instance.new("Frame")
- menuFrame.Size = UDim2.new(0, 220, 0, 300)
- menuFrame.Position = UDim2.new(1, -240, 0.5, -150)
- menuFrame.BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)
- menuFrame.BorderSizePixel = 0
- menuFrame.Visible = false
- menuFrame.Parent = ScreenGui
- local menuCorner = Instance.new("UICorner")
- menuCorner.CornerRadius = UDim.new(0, 10)
- menuCorner.Parent = menuFrame
- local anchoInput = createInputBox("Ancho:", UDim2.new(0, 10, 0, 10))
- anchoInput.Parent = menuFrame
- local alturaInput = createInputBox("Altura:", UDim2.new(0, 10, 0, 100))
- alturaInput.Parent = menuFrame
- local enableCuadroHitButton = createButton("Enable Cuadro Hit: OFF", UDim2.new(0, 10, 0, 190))
- enableCuadroHitButton.Parent = menuFrame
- local enableLookAtPlayerButton = createButton("Enable Look at Player: ON", UDim2.new(0, 10, 0, 250))
- enableLookAtPlayerButton.Parent = menuFrame
- local perseguirUsuarioButton = createButton("Perseguir Usuario: OFF", UDim2.new(0, 10, 0, 310))
- perseguirUsuarioButton.Parent = menuFrame
- local enableTeleportUserButton = createButton("Enable Teleport User: OFF", UDim2.new(0, 10, 0, 370))
- enableTeleportUserButton.Parent = menuFrame
- -- Funciones de la interfaz de usuario
- local function toggleMenu()
- menuFrame.Visible = not menuFrame.Visible
- end
- local function updateAnchoAltura()
- _G.Ancho = tonumber(anchoInput.Text) or _G.Ancho
- _G.Altura = tonumber(alturaInput.Text) or _G.Altura
- updateBoxes()
- end
- local function toggleEnableCuadroHit()
- _G.enablecuadrohit = not _G.enablecuadrohit
- enableCuadroHitButton.Text = "Enable Cuadro Hit: " .. (_G.enablecuadrohit and "ON" or "OFF")
- updateBoxes()
- end
- local function toggleEnableLookAtPlayer()
- _G.EnableLookatplayerclosset = not _G.EnableLookatplayerclosset
- enableLookAtPlayerButton.Text = "Enable Look at Player: " .. (_G.EnableLookatplayerclosset and "ON" or "OFF")
- end
- local function togglePerseguirUsuario()
- _G.PerseguirUsuarioNivel = (_G.PerseguirUsuarioNivel + 1) % 3
- if _G.PerseguirUsuarioNivel == 0 then
- perseguirUsuarioButton.Text = "Perseguir Usuario: OFF"
- perseguirUsuarioButton.BackgroundColor3 = Color3.new(1, 0, 0) -- Rojo
- elseif _G.PerseguirUsuarioNivel == 1 then
- perseguirUsuarioButton.Text = "Perseguir Usuario: Normal"
- perseguirUsuarioButton.BackgroundColor3 = Color3.new(0, 1, 0) -- Verde
- else
- perseguirUsuarioButton.Text = "Perseguir Usuario: Avanzado"
- perseguirUsuarioButton.BackgroundColor3 = Color3.new(1, 1, 0) -- Amarillo
- end
- end
- local function toggleEnableTeleportUser()
- _G.EnableTeleportUser = not _G.EnableTeleportUser
- enableTeleportUserButton.Text = "Enable Teleport User: " .. (_G.EnableTeleportUser and "ON" or "OFF")
- if _G.EnableTeleportUser then
- loadstring(game:HttpGet("https://pastebin.com/raw/R9Av86Wm"))()
- end
- end
- -- Conexiones de eventos de la interfaz de usuario
- menuButton.MouseButton1Click:Connect(toggleMenu)
- anchoInput.FocusLost:Connect(updateAnchoAltura)
- alturaInput.FocusLost:Connect(updateAnchoAltura)
- enableCuadroHitButton.MouseButton1Click:Connect(toggleEnableCuadroHit)
- enableLookAtPlayerButton.MouseButton1Click:Connect(toggleEnableLookAtPlayer)
- perseguirUsuarioButton.MouseButton1Click:Connect(togglePerseguirUsuario)
- enableTeleportUserButton.MouseButton1Click:Connect(toggleEnableTeleportUser)
- -- Bucle principal
- RunService.Heartbeat:Connect(function()
- updateBoxes()
- if _G.EnableLookatplayerclosset and playerHasItems(localPlayer) then
- lookAtClosestPlayer()
- end
- if _G.PerseguirUsuarioNivel > 0 and playerHasItems(localPlayer) then
- local closestPlayer = getClosestPlayer()
- if closestPlayer then
- if _G.PerseguirUsuarioNivel == 1 then
- moveToPlayerNormal(closestPlayer)
- else
- moveToPlayerAdvanced(closestPlayer)
- end
- end
- end
- if _G.EnableTeleportUser then
- TeleportCharacterToClosestPlayer()
- end
- end)
- -- Manejar el respawn del jugador
- localPlayer.CharacterAdded:Connect(function(newCharacter)
- character = newCharacter
- humanoid = newCharacter:WaitForChild("Humanoid")
- rootPart = newCharacter:WaitForChild("HumanoidRootPart")
- end)
- -- Inicialización
- anchoInput.Text = tostring(_G.Ancho)
- alturaInput.Text = tostring(_G.Altura)
- enableCuadroHitButton.Text = "Enable Cuadro Hit: " .. (_G.enablecuadrohit and "ON" or "OFF")
- enableLookAtPlayerButton.Text = "Enable Look at Player: " .. (_G.EnableLookatplayerclosset and "ON" or "OFF")
- perseguirUsuarioButton.Text = "Perseguir Usuario: " .. (_G.PerseguirUsuarioNivel == 0 and "OFF" or _G.PerseguirUsuarioNivel == 1 and "Normal" or "Avanzado")
- 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)
- enableTeleportUserButton.Text = "Enable Teleport User: " .. (_G.EnableTeleportUser and "ON" or "OFF")
- print("Script inicializado correctamente.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement