-- KillSwitch v2 — GUI mejorada + spam en rango optimizado -- Arranca OFF por defecto, pero lo podés cambiar. local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local Players = game:GetService("Players") local player = Players.LocalPlayer local task = task -- ===== CONFIG ===== local START_ENABLED = false -- true = arranca activado; false = arranca apagado local DEFAULT_KEY = Enum.KeyCode.K -- tecla por defecto para toggle local DEFAULT_RANGE = 8 -- rango por defecto local AUTOCLOSE_GUI_SEC = 0 -- >0 oculta GUI automáticamente tras esos segundos (0 = nunca) local LOOP_INTERVAL = 0.06 -- tiempo entre escaneos (segundos). Ajustalo si querés menos lag / más responsivo local SPAM_WAIT = 0.03 -- espera entre intentos de Activate() en el spam loop -- ================== local enabled = START_ENABLED local range = DEFAULT_RANGE local hotkey = DEFAULT_KEY local loopRunning = false local loopThread = nil local original_firetouch = firetouchinterest local patchedTools = {} -- map tool -> {origActivate = fn} local function noop_firetouch(...) end -- spam control (visibles para doRangeHit) local spamTask = nil local spamActive = false -- doRangeHit: detecta targets, hace firetouchinterest y controla spam de tool:Activate() local function doRangeHit() local p = Players:GetPlayers() local tool = player.Character and player.Character:FindFirstChildOfClass("Tool") local anyTarget = false if tool and tool:FindFirstChild("Handle") then -- buscar si hay al menos un objetivo en rango y aplicar firetouchinterest sobre partes for i = 1, #p do local other = p[i] if other ~= player then local v = other.Character if v and v:FindFirstChild("Humanoid") and v.Humanoid.Health > 0 and v:FindFirstChild("HumanoidRootPart") then local ok, dist = pcall(function() return player:DistanceFromCharacter(v.HumanoidRootPart.Position) end) if ok and dist and dist <= range then anyTarget = true for _, part in next, v:GetChildren() do if part:IsA("BasePart") then pcall(function() firetouchinterest(tool.Handle, part, 0) firetouchinterest(tool.Handle, part, 1) end) end end end end end end end -- manejar el spam: arrancar cuando aparece objetivo; parar cuando no hay if anyTarget and tool and tool.Parent == player.Character and enabled then if not spamActive then spamActive = true spamTask = task.spawn(function() -- este loop spamea Activate() tan rápido como el engine lo permita con una pequeña espera entre intentos while enabled and spamActive and tool and tool.Parent == player.Character do pcall(function() tool:Activate() end) task.wait(SPAM_WAIT) end end) end else spamActive = false spamTask = nil end end -- loop de ejecución controlado (optimizado para menos lag) local function connectLoop() if loopRunning then return end loopRunning = true loopThread = task.spawn(function() while loopRunning do if enabled then pcall(doRangeHit) end task.wait(LOOP_INTERVAL) end end) end local function disconnectLoop() loopRunning = false loopThread = nil end -- Parcheo de Tool:Activate para evitar activaciones locales local function patchToolActivate(tool) if not tool or patchedTools[tool] then return end local ok, orig = pcall(function() return tool.Activate end) if ok then patchedTools[tool] = {origActivate = orig} pcall(function() tool.Activate = function() end end) end end local function restoreToolActivate(tool) if not tool or not patchedTools[tool] then return end local data = patchedTools[tool] pcall(function() tool.Activate = data.origActivate end) patchedTools[tool] = nil end local function patchAllToolsInPlayer() -- patch tools in Backpack and Character local backpack = player:FindFirstChildOfClass("Backpack") if backpack then for _, t in pairs(backpack:GetChildren()) do if t:IsA("Tool") then patchToolActivate(t) end end end if player.Character then for _, t in pairs(player.Character:GetChildren()) do if t:IsA("Tool") then patchToolActivate(t) end end end end local function restoreAllTools() for tool, _ in pairs(patchedTools) do restoreToolActivate(tool) end end -- Activar / Desactivar con manejo de parches local function enableNow() enabled = true if original_firetouch then firetouchinterest = original_firetouch end restoreAllTools() connectLoop() pcall(function() player:SetAttribute("KillSwitchEnabled", true) end) print("[KillSwitch] ACTIVADO") end local function disableNow() enabled = false firetouchinterest = noop_firetouch patchAllToolsInPlayer() -- parar spam inmediatamente spamActive = false spamTask = nil disconnectLoop() pcall(function() player:SetAttribute("KillSwitchEnabled", false) end) print("[KillSwitch] DESACTIVADO (firetouch bloqueado, Tool.Activate parcheado)") end -- Exponer funciones globales para control por consola/otros scripts (útil en Studio) _G.killSwitchEnable = enableNow _G.killSwitchDisable = disableNow _G.killSwitchToggle = function() if enabled then disableNow() else enableNow() end end -- ========== GUI ========== local screenGui = Instance.new("ScreenGui") screenGui.Name = "KillSwitchGui" screenGui.ResetOnSpawn = false screenGui.Parent = player:WaitForChild("PlayerGui") local frame = Instance.new("Frame") frame.Size = UDim2.new(0,260,0,150) frame.Position = UDim2.new(0,12,0,12) frame.BackgroundTransparency = 0.2 frame.Parent = screenGui frame.Active = true frame.Draggable = true local title = Instance.new("TextLabel") title.Size = UDim2.new(1,0,0,28) title.Position = UDim2.new(0,0,0,0) title.BackgroundTransparency = 1 title.Text = "KillSwitch (Studio)" title.Font = Enum.Font.GothamBold title.TextScaled = true title.Parent = frame local status = Instance.new("TextLabel") status.Size = UDim2.new(1,0,0,24) status.Position = UDim2.new(0,0,0,34) status.BackgroundTransparency = 1 status.Text = "" status.TextScaled = false status.Font = Enum.Font.Gotham status.TextSize = 14 status.TextXAlignment = Enum.TextXAlignment.Left status.Parent = frame local toggleBtn = Instance.new("TextButton") toggleBtn.Size = UDim2.new(0,120,0,32) toggleBtn.Position = UDim2.new(0,0,0,64) toggleBtn.Text = "Toggle (K)" toggleBtn.Font = Enum.Font.GothamBold toggleBtn.TextScaled = true toggleBtn.Parent = frame local rangeLabel = Instance.new("TextLabel") rangeLabel.Size = UDim2.new(0,140,0,20) rangeLabel.Position = UDim2.new(0,0,0,100) rangeLabel.BackgroundTransparency = 1 rangeLabel.Font = Enum.Font.Gotham rangeLabel.TextSize = 14 rangeLabel.TextXAlignment = Enum.TextXAlignment.Left rangeLabel.Parent = frame local rangeBox = Instance.new("TextBox") rangeBox.Size = UDim2.new(0,80,0,22) rangeBox.Position = UDim2.new(0,150,0,98) rangeBox.Text = tostring(range) rangeBox.Font = Enum.Font.Gotham rangeBox.TextSize = 14 rangeBox.ClearTextOnFocus = false rangeBox.Parent = frame local keyLabel = Instance.new("TextLabel") keyLabel.Size = UDim2.new(0,120,0,20) keyLabel.Position = UDim2.new(0,0,0,124) keyLabel.BackgroundTransparency = 1 keyLabel.Font = Enum.Font.Gotham keyLabel.TextSize = 14 keyLabel.TextXAlignment = Enum.TextXAlignment.Left keyLabel.Parent = frame local keyBox = Instance.new("TextBox") keyBox.Size = UDim2.new(0,120,0,22) keyBox.Position = UDim2.new(0,130,0,122) keyBox.Text = tostring(hotkey.Name) keyBox.Font = Enum.Font.Gotham keyBox.TextSize = 14 keyBox.ClearTextOnFocus = false keyBox.Parent = frame local function updateStatus() status.Text = ("Status: %s Range: %s Key: %s"):format(enabled and "ON" or "OFF", tostring(range), tostring(hotkey.Name)) if enabled then frame.BackgroundColor3 = Color3.fromRGB(40,160,40) else frame.BackgroundColor3 = Color3.fromRGB(160,40,40) end end toggleBtn.Activated:Connect(function() if enabled then disableNow() else enableNow() end updateStatus() end) rangeBox.FocusLost:Connect(function(enter) if not enter then return end local v = tonumber(rangeBox.Text) if v and v > 0 then range = v else rangeBox.Text = tostring(range) end updateStatus() end) keyBox.FocusLost:Connect(function(enter) if not enter then return end local text = keyBox.Text:upper():gsub("%s+","") local ok, enum = pcall(function() return Enum.KeyCode[text] end) if ok and enum then hotkey = enum else keyBox.Text = tostring(hotkey.Name) end updateStatus() end) UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == hotkey then if enabled then disableNow() else enableNow() end updateStatus() end end) -- manejar herramientas que se agreguen mientras estamos desactivados/activados player.CharacterAdded:Connect(function(char) if not enabled then wait(0.2) patchAllToolsInPlayer() else wait(0.2) restoreAllTools() end end) local function watchContainer(container) if not container then return end container.ChildAdded:Connect(function(child) if child:IsA("Tool") then if not enabled then patchToolActivate(child) end end end) end watchContainer(player:FindFirstChildOfClass("Backpack")) if player.Character then watchContainer(player.Character) end if AUTOCLOSE_GUI_SEC > 0 then delay(AUTOCLOSE_GUI_SEC, function() if screenGui and screenGui.Parent then screenGui.Enabled = false end end) end -- inicialización: restaurar estado desde atributo si existe local attr = player:GetAttribute("KillSwitchEnabled") if attr ~= nil then enabled = (attr == true) else enabled = START_ENABLED end if enabled then enableNow() else disableNow() end updateStatus() -- ========================= -- Nota final: -- 1) Este script parchea globalmente `firetouchinterest` cuando está DESACTIVADO y trata de sobrescribir Tool:Activate -- para todas las herramientas propias del jugador. Es una medida defensiva para pruebas en Studio. -- 2) El spam de Activate() sólo corre cuando hay al menos 1 objetivo en el rango definido. -- 3) Si seguís con lag, bajá LOOP_INTERVAL (más alto = menos lag) o subí SPAM_WAIT (más alto = menos intentos por segundo).