Hitbox Expander
Key RequiredUniversal

Hitbox Expander

Universal ScriptKadenKZNKadenKZN 3.1K views 3.4K executesUpdated Jun 22, 2026
Unrated
00
Lua Script•302 lines (9690 chars)
-- Kaden's Hitbox Expander (Console Edition)
-- Version 2.2.0 - Status Panel with Toggle Key Hints

--[[
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    CORE REQUIREMENTS MET:
    • Zero GUI / Drawing API / Visual Elements (unless G pressed in debug mode)
    • Console Output Only
    • Hotkey Controlled ([, ], P, K, L, B, N, U, Y, G)
    • Invisible Hitboxes by default (Transparency = 1, CanCollide = false)
    • Max 15 FPS Update Loop
    • Lightweight Player Scanning
    • Automatic Character Management
    • Emergency Cleanup on Exit
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
]]

-- Services
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

-- Local References
local LocalPlayer = Players.LocalPlayer
local Workspace = workspace

-- Configuration (Matches DEFAULT SETTINGS + new toggles)
local Config = {
    Enabled = true,
    HitboxSize = 12,
    Transparency = 1,
    CanCollide = false,
    RefreshRate = 15,
    MaxDistance = math.huge,
    IgnoreTeam = true,
    IgnoreDead = true,
    IgnoreForceField = true,
    IgnoreSpawnProtection = true,
    DebugMode = false,
    VisualizeHitboxes = false -- Only active when DebugMode=true
}

-- State Tracking
local OriginalHitboxes = {} -- { hrp -> original size }
local CharacterCache = {}   -- { player -> character }
local LastUpdate = 0
local UpdateInterval = 1 / Config.RefreshRate

-- Utility: Print to console with prefix
local function Log(msg)
    print("[Hitbox Expander] " .. msg)
end

-- Utility: Get distance to target
local function GetDistance(targetHrp)
    if not LocalPlayer.Character or not LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then
        return math.huge
    end
    return (LocalPlayer.Character.HumanoidRootPart.Position - targetHrp.Position).Magnitude
end

-- Utility: Check if player should be targeted
local function ShouldTarget(player, character)
    if player == LocalPlayer then return false end
    if not character or not character.Parent then return false end

    local hrp = character:FindFirstChild("HumanoidRootPart")
    if not hrp then return false end

    -- Team check
    if Config.IgnoreTeam and LocalPlayer.Team and player.Team and LocalPlayer.Team == player.Team then
        return false
    end

    -- Dead check
    if Config.IgnoreDead then
        local humanoid = character:FindFirstChildOfClass("Humanoid")
        if not humanoid or humanoid.Health <= 0 then return false end
    end

    -- ForceField check
    if Config.IgnoreForceField and character:FindFirstChildOfClass("ForceField") then
        return false
    end

    -- Spawn protection (3-second window)
    if Config.IgnoreSpawnProtection then
        local cache = CharacterCache[player]
        if cache and cache.SpawnTime and (tick() - cache.SpawnTime) < 3 then
            return false
        end
    end

    -- Distance check
    if GetDistance(hrp) > Config.MaxDistance then
        return false
    end

    return true
end

-- Store original hitbox properties
local function StoreOriginal(hrp)
    if not OriginalHitboxes[hrp] then
        OriginalHitboxes[hrp] = {
            Size = hrp.Size,
            Transparency = hrp.Transparency,
            CanCollide = hrp.CanCollide
        }
    end
end

-- Restore original hitbox
local function RestoreHitbox(hrp)
    if OriginalHitboxes[hrp] then
        pcall(function()
            hrp.Size = OriginalHitboxes[hrp].Size
            hrp.Transparency = OriginalHitboxes[hrp].Transparency
            hrp.CanCollide = OriginalHitboxes[hrp].CanCollide
        end)
        OriginalHitboxes[hrp] = nil
    end
end

-- Apply hitbox expansion
local function ApplyHitbox(hrp)
    StoreOriginal(hrp)
    pcall(function()
        hrp.Size = Vector3.new(Config.HitboxSize, Config.HitboxSize, Config.HitboxSize)
        hrp.CanCollide = Config.CanCollide
        
        -- Visualization only in debug mode
        if Config.DebugMode and Config.VisualizeHitboxes then
            hrp.Transparency = 0.7
        else
            hrp.Transparency = Config.Transparency
        end
    end)
end

-- Restore ALL hitboxes (emergency cleanup)
local function RestoreAll()
    for hrp in pairs(OriginalHitboxes) do
        RestoreHitbox(hrp)
    end
end

-- Process all valid players
local function ProcessPlayers()
    local targets = 0
    for _, player in ipairs(Players:GetPlayers()) do
        local character = CharacterCache[player] and CharacterCache[player].Character
        if character and ShouldTarget(player, character) then
            local hrp = character:FindFirstChild("HumanoidRootPart")
            if hrp then
                ApplyHitbox(hrp)
                targets += 1
            end
        else
            -- Clean up invalid entries
            local hrp = character and character:FindFirstChild("HumanoidRootPart")
            if hrp and OriginalHitboxes[hrp] then
                RestoreHitbox(hrp)
            end
        end
    end
    return targets
end

-- Main update loop (capped at 15 FPS)
local function Update()
    if not Config.Enabled then return end

    local now = tick()
    if now - LastUpdate < UpdateInterval then return end
    LastUpdate = now

    ProcessPlayers()
end

-- Handle new characters
local function OnCharacterAdded(player, character)
    CharacterCache[player] = {
        Character = character,
        SpawnTime = tick()
    }
    character:WaitForChild("HumanoidRootPart", 5)
end

-- Handle player removal
local function OnPlayerRemoving(player)
    local data = CharacterCache[player]
    if data and data.Character then
        local hrp = data.Character:FindFirstChild("HumanoidRootPart")
        if hrp then
            RestoreHitbox(hrp)
        end
    end
    CharacterCache[player] = nil
end

-- Setup player listeners
local function InitPlayers()
    for _, player in ipairs(Players:GetPlayers()) do
        if player.Character then
            OnCharacterAdded(player, player.Character)
        end
        player.CharacterAdded:Connect(function(char) OnCharacterAdded(player, char) end)
    end
    Players.PlayerRemoving:Connect(OnPlayerRemoving)
end

-- Hotkey handler
local function OnInput(input, gameProcessed)
    if gameProcessed then return end

    local key = input.KeyCode
    local changed = false

    if key == Enum.KeyCode.LeftBracket then
        Config.HitboxSize = math.clamp(Config.HitboxSize + 1, 1, 100)
        Log("Size Increased: " .. Config.HitboxSize)
        changed = true
    elseif key == Enum.KeyCode.RightBracket then
        Config.HitboxSize = math.clamp(Config.HitboxSize - 1, 1, 100)
        Log("Size Decreased: " .. Config.HitboxSize)
        changed = true
    elseif key == Enum.KeyCode.L then
        Config.DebugMode = not Config.DebugMode
        Log("Debug Mode: " .. (Config.DebugMode and "Enabled" or "Disabled"))
        if Config.Enabled then changed = true end
    elseif key == Enum.KeyCode.N then
        RestoreAll()
        Log("Emergency Restore Completed")
    elseif key == Enum.KeyCode.U then
        Config.IgnoreTeam = not Config.IgnoreTeam
        Log("Ignore Teammates: " .. tostring(Config.IgnoreTeam))
    elseif key == Enum.KeyCode.Y then
        Config.IgnoreDead = not Config.IgnoreDead
        Log("Ignore Dead Players: " .. tostring(Config.IgnoreDead))
    elseif key == Enum.KeyCode.G then
        if Config.DebugMode then
            Config.VisualizeHitboxes = not Config.VisualizeHitboxes
            Log("Hitbox Visualization: " .. (Config.VisualizeHitboxes and "Enabled" or "Disabled"))
            if Config.Enabled then changed = true end
        else
            Log("Visualization requires Debug Mode (press L first)")
        end
    elseif key == Enum.KeyCode.K then
        Config.Enabled = not Config.Enabled
        Log(Config.Enabled and "Enabled" or "Disabled")
        if not Config.Enabled then RestoreAll() end
    elseif key == Enum.KeyCode.P then
        -- Re-sync all character states
        RestoreAll()
        CharacterCache = {}
        InitPlayers()
        Log("Re-synced All Character States")
        Log("Current Size: " .. Config.HitboxSize)
    elseif key == Enum.KeyCode.B then
        local totalPlayers = #Players:GetPlayers()
        local targets = ProcessPlayers() -- Force refresh count
        Log("━━━━━━━━━━━━━━━━━━━━")
        Log("Hitbox Expander Status")
        Log("━━━━━━━━━━━━━━━━━━━━")
        Log("Enabled: " .. tostring(Config.Enabled) .. " [K]")
        Log("Hitbox Size: " .. Config.HitboxSize .. " [[ / ]]")
        Log("Refresh Rate: " .. Config.RefreshRate)
        Log("Targets Found: " .. targets)
        Log("Total Players: " .. totalPlayers)
        Log("Optimization Mode: Enabled")
        Log("Debug Mode: " .. tostring(Config.DebugMode) .. " [L]")
        Log("Visualize Hitboxes: " .. tostring(Config.VisualizeHitboxes and Config.DebugMode) .. " [G]")
        Log("Ignore Teammates: " .. tostring(Config.IgnoreTeam) .. " [U]")
        Log("Ignore Dead: " .. tostring(Config.IgnoreDead) .. " [Y]")
        Log("━━━━━━━━━━━━━━━━━━━━")
    end

    if changed and Config.Enabled then
        RestoreAll() -- Reapply with new settings
    end
end

-- Cleanup on script end
local function Cleanup()
    RestoreAll()
    CharacterCache = {}
    OriginalHitboxes = {}
end

-- Initialize
InitPlayers()
UserInputService.InputBegan:Connect(OnInput)
RunService.Heartbeat:Connect(Update)

-- Finalize setup
Log("Loaded Successfully")
Log("Current Size: " .. Config.HitboxSize)
Log("FPS Limit: " .. Config.RefreshRate)

-- Emergency cleanup hook
game:BindToClose(Cleanup)

Features & Information

Core Features Invisible Hitbox Expansion — Stretches enemy hitboxes with full transparency (no visual indicator) 15 FPS Hard Cap — Update loop locked to 15 FPS for low-end PC performance Zero GUI — No Rayfield, no Drawing API, no ScreenGui, no CoreGui clutter Console-Only Output — All feedback through developer console Hotkey-Only Control — Full control via keyboard shortcuts Hitbox Controls [ — Increase hitbox size by 1 ] — Decrease hitbox size by 1 L — Reset hitbox size to 12 K — Toggle Hitbox Expander ON/OFF P — Reload / reapply hitboxes N — Emergency restore (instantly restores all hitboxes) G — Toggle hitbox visualization (red debug view, only visible to you) Toggle Filters U — Toggle ignore teammates Y — Toggle ignore dead players Ignore ForceField users — Always on Ignore spawn protection — Always on (3 second window) Status / Debug B — Display current settings + toggle states in console RightAlt + L — Toggle debug console stats (live stats every 1 second) Live stats tracked: Enabled state, hitbox size, target count, total players, all toggle states Player Management Automatic player detection — Scans all players each frame Character cache system — Stores character references for performance Auto-handle player joining — PlayerAdded listener Auto-handle player leaving — PlayerRemoving listener (restores hitbox on leave) Auto reapply after respawn — CharacterAdded listener per player Auto restore on death — Restores hitbox when humanoid dies Re-sync all character states — P refreshes all character data Performance Optimizations 15 FPS hard cap — Capped update interval Cached character lookups — No repeated FindFirstChild calls Smart skip — Loop exits early if local character not ready Minimal memory footprint — Lightweight tables, no extra instances pcall protection — On all property writes Auto-recovery — Re-stores original data if hitbox is reset Advanced Features Save hitbox size between reloads — Persists to KadenHitboxExpander_Size.txt Closest-player prioritization mode — Prioritization = "Closest" setting Distance limiter — UseMaxDistance + MaxDistance settings Original hitbox restoration — Stores Size, Transparency, CanCollide, BrickColor, Material Emergency restore on unload — Cleanup hook via CoreGui.ChildRemoved Team detection — Checks LocalPlayer.Team vs player.Team ForceField detection — Scans for ForceField child Spawn protection detection — 3 second post-spawn window + SpawnProtection child check Ignored Targets (auto-filtered) Local player Players without HumanoidRootPart Dead players (0 HP) Teammates (when toggle on) ForceField users Players within spawn protection window Invalid/missing characters Hotkey Cooldown 0.15s throttle — Prevents key spam from flooding the loop Keybind Cheat Sheet Key Action [ Increase size +1 ] Decrease size -1 P Reload / reapply K Toggle ON/OFF L Reset size to 12 B Show status N Emergency restore U Toggle ignore teammates Y Toggle ignore dead G Toggle hitbox visualization RAlt+L Toggle debug stats
#FPS#Hitbox#Hitbox Expander#Universal#Secret

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts