Pastebin
Paste #34655: No description
< previous paste - next paste>
Pasted by Anonymous Coward
-- Services local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local GuiService = game:GetService("GuiService") -- Core Variables local LocalPlayer = Players.LocalPlayer local LightsaberRemotes = ReplicatedStorage:WaitForChild("LightsaberRemotes") local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait() -- Remote References local BlockRemote = LightsaberRemotes:WaitForChild("Block") local UnblockRemote = LightsaberRemotes:WaitForChild("Unblock") local AttackRemote = LightsaberRemotes:WaitForChild("Attack") local SwingRemote = LightsaberRemotes:WaitForChild("Swing") local OnHitRemote = LightsaberRemotes:WaitForChild("OnHit") -- Settings local killAllEnabled = false local killAuraEnabled = false local autoAttackEnabled = false local autoBlockEnabled = false local teleportOffset = 3 local detectionRange = 25 local attackRange = 12 local attackDelay = 0.05 local teleportDelay = 0.1 local blockCheckDelay = 0.15 -- Attack types local ATTACK_TYPES = {1, 2, 3} -- Threads local autoAttackThread = nil local killAuraThread = nil local killAllThread = nil local autoBlockThread = nil -- Check if mobile platform local isMobile = (UserInputService.TouchEnabled and not UserInputService.KeyboardEnabled and not UserInputService.MouseEnabled) -- Auto-detect performance settings based on platform if isMobile then -- Mobile optimization attackDelay = 0.1 teleportDelay = 0.15 blockCheckDelay = 0.2 elseif RunService:IsStudio() or not RunService:IsRunning() then -- Studio/testing optimization attackDelay = 0.05 teleportDelay = 0.1 blockCheckDelay = 0.15 else -- Default PC settings attackDelay = 0.03 teleportDelay = 0.07 blockCheckDelay = 0.1 end -- Create GUI if it doesn't exist already local screenGui = game.CoreGui:FindFirstChild("SaberScript") if not screenGui then screenGui = Instance.new("ScreenGui") screenGui.Name = "SaberScript" screenGui.ResetOnSpawn = false screenGui.Parent = game.CoreGui end -- Clean up existing GUI elements if script is re-executed if screenGui:FindFirstChild("MainFrame") then screenGui.MainFrame:Destroy() end if screenGui:FindFirstChild("MinimizedFrame") then screenGui.MinimizedFrame:Destroy() end -- Main Frame - Compact Design local mainFrame = Instance.new("Frame") mainFrame.Name = "MainFrame" mainFrame.Size = UDim2.new(0, 180, 0, 220) -- More compact size mainFrame.Position = isMobile and UDim2.new(0.5, -90, 0.5, -110) or UDim2.new(1, -190, 0.5, -110) mainFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 35) mainFrame.BorderSizePixel = 0 mainFrame.Active = true mainFrame.Draggable = true mainFrame.Parent = screenGui -- Minimized Frame (hidden initially) local minimizedFrame = Instance.new("Frame") minimizedFrame.Name = "MinimizedFrame" minimizedFrame.Size = UDim2.new(0, 100, 0, 30) minimizedFrame.Position = UDim2.new(0.5, -50, 0, 10) minimizedFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 35) minimizedFrame.BorderSizePixel = 0 minimizedFrame.Active = true minimizedFrame.Draggable = true minimizedFrame.Visible = false minimizedFrame.Parent = screenGui -- Round corners for both frames local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 8) corner.Parent = mainFrame corner:Clone().Parent = minimizedFrame -- Minimized Frame UI local miniLabel = Instance.new("TextLabel") miniLabel.Name = "MiniLabel" miniLabel.Text = "SABER AURA" miniLabel.Size = UDim2.new(1, -40, 1, 0) miniLabel.Position = UDim2.new(0, 5, 0, 0) miniLabel.Font = Enum.Font.GothamBold miniLabel.TextColor3 = Color3.fromRGB(255, 255, 255) miniLabel.TextSize = 14 miniLabel.BackgroundTransparency = 1 miniLabel.Parent = minimizedFrame local expandButton = Instance.new("TextButton") expandButton.Name = "ExpandButton" expandButton.Text = "+" expandButton.Size = UDim2.new(0, 25, 0, 25) expandButton.Position = UDim2.new(1, -30, 0.5, -12.5) expandButton.Font = Enum.Font.GothamBold expandButton.TextColor3 = Color3.fromRGB(255, 255, 255) expandButton.TextSize = 16 expandButton.BackgroundColor3 = Color3.fromRGB(50, 50, 70) expandButton.BorderSizePixel = 0 expandButton.Parent = minimizedFrame local expandCorner = Instance.new("UICorner") expandCorner.CornerRadius = UDim.new(0, 6) expandCorner.Parent = expandButton -- Main Frame UI local titleLabel = Instance.new("TextLabel") titleLabel.Name = "Title" titleLabel.Text = "SABER AURA" titleLabel.Size = UDim2.new(1, -70, 0, 25) titleLabel.Position = UDim2.new(0, 5, 0, 5) titleLabel.Font = Enum.Font.GothamBold titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255) titleLabel.TextSize = 16 titleLabel.BackgroundTransparency = 1 titleLabel.Parent = mainFrame -- Minimize button local minimizeButton = Instance.new("TextButton") minimizeButton.Name = "MinimizeButton" minimizeButton.Text = "-" minimizeButton.Size = UDim2.new(0, 25, 0, 25) minimizeButton.Position = UDim2.new(1, -60, 0, 5) minimizeButton.Font = Enum.Font.GothamBold minimizeButton.TextColor3 = Color3.fromRGB(255, 255, 255) minimizeButton.TextSize = 18 minimizeButton.BackgroundColor3 = Color3.fromRGB(50, 50, 70) minimizeButton.BorderSizePixel = 0 minimizeButton.Parent = mainFrame local minimizeCorner = Instance.new("UICorner") minimizeCorner.CornerRadius = UDim.new(0, 6) minimizeCorner.Parent = minimizeButton -- Close button local closeButton = Instance.new("TextButton") closeButton.Name = "CloseButton" closeButton.Text = "X" closeButton.Size = UDim2.new(0, 25, 0, 25) closeButton.Position = UDim2.new(1, -30, 0, 5) closeButton.Font = Enum.Font.GothamBold closeButton.TextColor3 = Color3.fromRGB(255, 255, 255) closeButton.TextSize = 14 closeButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50) closeButton.BorderSizePixel = 0 closeButton.Parent = mainFrame local closeCorner = Instance.new("UICorner") closeCorner.CornerRadius = UDim.new(0, 6) closeCorner.Parent = closeButton -- Main toggle buttons local buttonHeight = 30 local buttonSpacing = 5 local startY = 35 -- Kill Aura Button local killAuraButton = Instance.new("TextButton") killAuraButton.Name = "KillAuraButton" killAuraButton.Text = "KILL AURA: OFF" killAuraButton.Size = UDim2.new(1, -20, 0, buttonHeight) killAuraButton.Position = UDim2.new(0, 10, 0, startY) killAuraButton.Font = Enum.Font.GothamBold killAuraButton.TextColor3 = Color3.fromRGB(255, 255, 255) killAuraButton.TextSize = 14 killAuraButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50) killAuraButton.BorderSizePixel = 0 killAuraButton.Parent = mainFrame local killAuraCorner = Instance.new("UICorner") killAuraCorner.CornerRadius = UDim.new(0, 6) killAuraCorner.Parent = killAuraButton -- Kill All Button local killAllButton = Instance.new("TextButton") killAllButton.Name = "KillAllButton" killAllButton.Text = "KILL ALL: OFF" killAllButton.Size = UDim2.new(1, -20, 0, buttonHeight) killAllButton.Position = UDim2.new(0, 10, 0, startY + buttonHeight + buttonSpacing) killAllButton.Font = Enum.Font.GothamBold killAllButton.TextColor3 = Color3.fromRGB(255, 255, 255) killAllButton.TextSize = 14 killAllButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50) killAllButton.BorderSizePixel = 0 killAllButton.Parent = mainFrame local killAllCorner = Instance.new("UICorner") killAllCorner.CornerRadius = UDim.new(0, 6) killAllCorner.Parent = killAllButton -- Auto Attack Button local autoAttackButton = Instance.new("TextButton") autoAttackButton.Name = "AutoAttackButton" autoAttackButton.Text = "AUTO ATTACK: OFF" autoAttackButton.Size = UDim2.new(1, -20, 0, buttonHeight) autoAttackButton.Position = UDim2.new(0, 10, 0, startY + (buttonHeight + buttonSpacing) * 2) autoAttackButton.Font = Enum.Font.GothamBold autoAttackButton.TextColor3 = Color3.fromRGB(255, 255, 255) autoAttackButton.TextSize = 14 autoAttackButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50) autoAttackButton.BorderSizePixel = 0 autoAttackButton.Parent = mainFrame local autoAttackCorner = Instance.new("UICorner") autoAttackCorner.CornerRadius = UDim.new(0, 6) autoAttackCorner.Parent = autoAttackButton -- Auto Block Button local autoBlockButton = Instance.new("TextButton") autoBlockButton.Name = "AutoBlockButton" autoBlockButton.Text = "AUTO BLOCK: OFF" autoBlockButton.Size = UDim2.new(1, -20, 0, buttonHeight) autoBlockButton.Position = UDim2.new(0, 10, 0, startY + (buttonHeight + buttonSpacing) * 3) autoBlockButton.Font = Enum.Font.GothamBold autoBlockButton.TextColor3 = Color3.fromRGB(255, 255, 255) autoBlockButton.TextSize = 14 autoBlockButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50) autoBlockButton.BorderSizePixel = 0 autoBlockButton.Parent = mainFrame local autoBlockCorner = Instance.new("UICorner") autoBlockCorner.CornerRadius = UDim.new(0, 6) autoBlockCorner.Parent = autoBlockButton -- Status label local statusLabel = Instance.new("TextLabel") statusLabel.Name = "StatusLabel" statusLabel.Text = "READY" statusLabel.Size = UDim2.new(1, -20, 0, 20) statusLabel.Position = UDim2.new(0, 10, 0, startY + (buttonHeight + buttonSpacing) * 4 + 5) statusLabel.Font = Enum.Font.Gotham statusLabel.TextColor3 = Color3.fromRGB(0, 255, 0) statusLabel.TextSize = 12 statusLabel.TextXAlignment = Enum.TextXAlignment.Left statusLabel.BackgroundTransparency = 1 statusLabel.Parent = mainFrame -- Functions local function updateStatus(message, color) statusLabel.Text = message statusLabel.TextColor3 = color or Color3.fromRGB(255, 255, 255) end -- Function to get nearby targets (for Kill Aura) local function getNearbyTargets() local targets = {} for _, player in pairs(Players:GetPlayers()) do if player ~= LocalPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") and player.Character:FindFirstChild("Humanoid") and player.Character.Humanoid.Health > 0 then local distance = (player.Character.HumanoidRootPart.Position - LocalPlayer.Character.HumanoidRootPart.Position).Magnitude if distance <= detectionRange then table.insert(targets, { player = player, character = player.Character, distance = distance }) end end end -- Sort by distance table.sort(targets, function(a, b) return a.distance < b.distance end) return targets end -- Function to get all valid targets (for Kill All) local function getAllTargets() local targets = {} for _, player in pairs(Players:GetPlayers()) do if player ~= LocalPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") and player.Character:FindFirstChild("Humanoid") and player.Character.Humanoid.Health > 0 then table.insert(targets, { player = player, character = player.Character, distance = (player.Character.HumanoidRootPart.Position - LocalPlayer.Character.HumanoidRootPart.Position).Magnitude }) end end -- Sort by distance table.sort(targets, function(a, b) return a.distance < b.distance end) return targets end -- Function to check if any enemies are near that might attack local function hasNearbyThreats() for _, player in pairs(Players:GetPlayers()) do if player ~= LocalPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") and player.Character:FindFirstChild("Humanoid") and player.Character.Humanoid.Health > 0 then local distance = (player.Character.HumanoidRootPart.Position - LocalPlayer.Character.HumanoidRootPart.Position).Magnitude if distance <= attackRange * 1.5 then return true end end end return false end -- Improved attack function with better hit detection local function attackTarget(targetCharacter) if not targetCharacter or not LocalPlayer.Character then return end -- Make sure we're not blocking when attacking pcall(function() UnblockRemote:FireServer() end) task.wait(0.02) -- Small delay to ensure unblock happens -- Select attack type local attackType = ATTACK_TYPES[math.random(1, #ATTACK_TYPES)] -- Set up attack arguments local attackArgs = { [1] = attackType, [2] = math.random(1, 2), [3] = false, [4] = false } -- Execute attack sequence pcall(function() -- Attack sequence AttackRemote:FireServer(unpack(attackArgs)) SwingRemote:FireServer() -- Multi-point hit detection for better hit registration local hitParts = { targetCharacter, targetCharacter:FindFirstChild("HumanoidRootPart"), targetCharacter:FindFirstChild("Head"), targetCharacter:FindFirstChild("UpperTorso") or targetCharacter:FindFirstChild("Torso"), targetCharacter:FindFirstChild("LowerTorso"), targetCharacter:FindFirstChild("Humanoid") } -- Try to hit all possible parts for _, part in pairs(hitParts) do if part then OnHitRemote:FireServer(part) end end end) end -- Function to teleport behind target local function teleportBehind(target) if not target or not target.character or not target.character:FindFirstChild("HumanoidRootPart") or not LocalPlayer.Character or not LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then return false end local targetHRP = target.character.HumanoidRootPart local targetCFrame = targetHRP.CFrame -- Position behind the player local behindPosition = targetCFrame * CFrame.new(0, 0, teleportOffset) -- Teleport LocalPlayer.Character.HumanoidRootPart.CFrame = behindPosition return true end -- Handle block state local function setBlockState(shouldBlock) if shouldBlock then pcall(function() BlockRemote:FireServer() end) else pcall(function() UnblockRemote:FireServer() end) end end -- Improved auto block function local function startAutoBlock() if autoBlockThread then pcall(function() task.cancel(autoBlockThread) end) autoBlockThread = nil end if not autoBlockEnabled then return end autoBlockThread = task.spawn(function() local isBlocking = false while autoBlockEnabled and not (killAuraEnabled or killAllEnabled) do -- Check if we need to block local shouldBlock = hasNearbyThreats() -- Toggle block state if needed if shouldBlock and not isBlocking then setBlockState(true) isBlocking = true updateStatus("BLOCKING", Color3.fromRGB(0, 200, 255)) elseif not shouldBlock and isBlocking then setBlockState(false) isBlocking = false updateStatus("IDLE", Color3.fromRGB(0, 255, 0)) end task.wait(blockCheckDelay) end -- Make sure to unblock when turning off auto block setBlockState(false) updateStatus("IDLE", Color3.fromRGB(0, 255, 0)) end) end -- Enhanced Kill Aura / Kill All combat function local function startCombatMode() if autoAttackThread then pcall(function() task.cancel(autoAttackThread) end) autoAttackThread = nil end -- Stop standalone auto block thread if it's running if autoBlockThread then pcall(function() task.cancel(autoBlockThread) end) autoBlockThread = nil end autoAttackThread = task.spawn(function() local lastAttackTime = 0 local targetInRange = false while killAuraEnabled or killAllEnabled do local targets if killAuraEnabled then targets = getNearbyTargets() updateStatus("KILL AURA: "..#targets.." TARGETS", Color3.fromRGB(255, 100, 100)) else targets = getAllTargets() updateStatus("KILL ALL: "..#targets.." TARGETS", Color3.fromRGB(255, 50, 50)) end -- Check if there are targets in attack range targetInRange = false for _, target in ipairs(targets) do if (killAuraEnabled and target.distance <= attackRange) or killAllEnabled then targetInRange = true break end end -- Handle blocking based on situation if not targetInRange and autoBlockEnabled then -- No targets in range, block if there are threats if hasNearbyThreats() then setBlockState(true) updateStatus("BLOCKING", Color3.fromRGB(0, 200, 255)) end else -- Targets in range, unblock to attack setBlockState(false) end -- Only attack in attack range for kill aura, or any target for kill all for _, target in ipairs(targets) do if not (killAuraEnabled or killAllEnabled) then break end local currentTime = os.clock() if currentTime - lastAttackTime >= attackDelay then if (killAuraEnabled and target.distance <= attackRange) or killAllEnabled then -- For Kill All, teleport to target first if killAllEnabled then teleportBehind(target) task.wait(teleportDelay * 0.5) end attackTarget(target.character) lastAttackTime = currentTime break -- Only attack one target per cycle end end end -- Re-engage block immediately after attack if needed if autoBlockEnabled and not targetInRange and hasNearbyThreats() then setBlockState(true) updateStatus("BLOCKING", Color3.fromRGB(0, 200, 255)) end task.wait(attackDelay) end -- Restart standalone auto block if it was enabled if autoBlockEnabled and not (killAuraEnabled or killAllEnabled) then startAutoBlock() end end) end -- Kill Aura thread handling local function toggleKillAura() killAuraEnabled = not killAuraEnabled if killAuraEnabled then killAuraButton.Text = "KILL AURA: ON" killAuraButton.BackgroundColor3 = Color3.fromRGB(0, 200, 0) -- Disable Kill All if it's active if killAllEnabled then killAllEnabled = false killAllButton.Text = "KILL ALL: OFF" killAllButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50) end killAuraThread = task.spawn(function() while killAuraEnabled do local targets = getNearbyTargets() for _, target in ipairs(targets) do if not killAuraEnabled then break end if target.distance <= attackRange then -- Already handled in startCombatMode else -- Teleport to targets outside attackRange but inside detectionRange if target.distance <= detectionRange then if teleportBehind(target) then task.wait(teleportDelay) -- Wait after teleport end end end end task.wait(teleportDelay) end end) -- Start the combat mode that handles attacking startCombatMode() else killAuraButton.Text = "KILL AURA: OFF" killAuraButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50) updateStatus("IDLE", Color3.fromRGB(0, 255, 0)) if killAuraThread then pcall(function() task.cancel(killAuraThread) end) killAuraThread = nil end -- Restart auto block if it was enabled if autoBlockEnabled then startAutoBlock() end end end -- Enhanced Kill All thread handling local function toggleKillAll() killAllEnabled = not killAllEnabled if killAllEnabled then killAllButton.Text = "KILL ALL: ON" killAllButton.BackgroundColor3 = Color3.fromRGB(0, 200, 0) -- Disable Kill Aura if it's active if killAuraEnabled then killAuraEnabled = false killAuraButton.Text = "KILL AURA: OFF" killAuraButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50) end killAllThread = task.spawn(function() while killAllEnabled do local targets = getAllTargets() for _, target in ipairs(targets) do if not killAllEnabled then break end -- Teleport behind target and attack if teleportBehind(target) then task.wait(teleportDelay * 0.5) -- Wait after teleport before next target end end task.wait(teleportDelay) end end) -- Start the combat mode that handles attacking startCombatMode() else killAllButton.Text = "KILL ALL: OFF" killAllButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50) updateStatus("IDLE", Color3.fromRGB(0, 255, 0)) if killAllThread then pcall(function() task.cancel(killAllThread) end) killAllThread = nil end -- Restart auto block if it was enabled if autoBlockEnabled then startAutoBlock() end end end -- Auto Attack toggle function local function toggleAutoAttack() autoAttackEnabled = not autoAttackEnabled if autoAttackEnabled then autoAttackButton.Text = "AUTO ATTACK: ON" autoAttackButton.BackgroundColor3 = Color3.fromRGB(0, 200, 0) -- Create auto attack thread only if kill features aren't active if not (killAuraEnabled or killAllEnabled) then autoAttackThread = task.spawn(function() while autoAttackEnabled and not (killAuraEnabled or killAllEnabled) do local targets = getNearbyTargets() updateStatus("AUTO ATTACK: "..#targets.." TARGETS", Color3.fromRGB(255, 150, 0)) for _, target in ipairs(targets) do if target.distance <= attackRange then attackTarget(target.character) break end end task.wait(attackDelay) end end) end else autoAttackButton.Text = "AUTO ATTACK: OFF" autoAttackButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50) updateStatus("IDLE", Color3.fromRGB(0, 255, 0)) if autoAttackThread then pcall(function() task.cancel(autoAttackThread) end) autoAttackThread = nil end end end -- Auto Block toggle function local function toggleAutoBlock() autoBlockEnabled = not autoBlockEnabled if autoBlockEnabled then autoBlockButton.Text = "AUTO BLOCK: ON" autoBlockButton.BackgroundColor3 = Color3.fromRGB(0, 200, 0) -- Only start standalone auto block if kill features aren't active if not (killAuraEnabled or killAllEnabled) then startAutoBlock() end else autoBlockButton.Text = "AUTO BLOCK: OFF" autoBlockButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50) updateStatus("IDLE", Color3.fromRGB(0, 255, 0)) if autoBlockThread then pcall(function() task.cancel(autoBlockThread) end) autoBlockThread = nil end -- Make sure to unblock when turning off setBlockState(false) end end -- Toggle minimized state local function toggleMinimize() isMinimized = not isMinimized mainFrame.Visible = not isMinimized minimizedFrame.Visible = isMinimized end -- Event Connections killAuraButton.MouseButton1Click:Connect(toggleKillAura) killAllButton.MouseButton1Click:Connect(toggleKillAll) autoAttackButton.MouseButton1Click:Connect(toggleAutoAttack) autoBlockButton.MouseButton1Click:Connect(toggleAutoBlock) closeButton.MouseButton1Click:Connect(function() screenGui:Destroy() -- Clean up all threads if killAuraThread then pcall(function() task.cancel(killAuraThread) end) end if killAllThread then pcall(function() task.cancel(killAllThread) end) end if autoAttackThread then pcall(function() task.cancel(autoAttackThread) end) end if autoBlockThread then pcall(function() task.cancel(autoBlockThread) end) end end) minimizeButton.MouseButton1Click:Connect(toggleMinimize) expandButton.MouseButton1Click:Connect(toggleMinimize) -- Make sure character is ready LocalPlayer.CharacterAdded:Connect(function(newCharacter) Character = newCharacter task.wait(1) updateStatus("READY", Color3.fromRGB(0, 255, 0)) end) -- Initial status updateStatus("READY", Color3.fromRGB(0, 255, 0)) -- Signal that script loaded successfully local function notify(message) game.StarterGui:SetCore("SendNotification", { Title = "Saber Aura", Text = message, Duration = 3 }) end notify("Script Loaded Successfully!")
New Paste
Go to most recent paste.