05-03-26

Turbo Key Combinations Lua Script

Create rapid-fire key combinations with this Lua script for hardware input. Configure turbo keys like Mouse1, LShift+1, or LCtrl+C to repeat while held, enhancing your control with Rebind.

rebindlua scriptturbokey combinationsrapid firehardware inputscript

Question

Turbo click on Mouse1 hold

Rebind AI

luau
-- rebind: name=Turbo Click
-- rebind: description=Rapid fire clicking while holding Mouse1

local cfg = UI.Schema({
    cps = UI.Slider(10, { min = 1, max = 20, label = "Clicks Per Second" }),
    enabled = UI.Toggle(true, { label = "Enable" }),
})

local clickTask = nil

function OnDown(key)
    if key == "Mouse1" and cfg.enabled then
        clickTask = Run(function()
            while Input.IsDown("Mouse1") do
                HID.Press("Mouse1", 20)
                Sleep(1000 / cfg.cps)
            end
        end)
        return false
    end
    return true
end

function OnUp(key)
    if key == "Mouse1" then
        if clickTask and clickTask:IsRunning() then
            clickTask:Cancel()
        end
        return false
    end
    return true
end

function OnStop()
    if clickTask and clickTask:IsRunning() then
        clickTask:Cancel()
    end
end

function OnBlur()
    if clickTask and clickTask:IsRunning() then
        clickTask:Cancel()
    end
end

How it works

This script detects when you hold down the left mouse button and automatically fires rapid clicks at a configurable rate (1–20 clicks per second).

Key features:

  • When you press Mouse1, a coroutine starts firing clicks in a loop every 1000 / cps milliseconds
  • The loop continues only while Mouse1 is physically held down (checked via Input.IsDown)
  • When you release Mouse1, the coroutine stops and the original mouse button press is blocked
  • The cps slider lets you tune click speed without restarting
  • OnStop and OnBlur clean up the task to prevent leaks

The script blocks the original Mouse1 press and release events, replacing them with rapid synthetic clicks. Remove return false from the hooks if you want clicks to pass through alongside the turbo fire.

Learn more:

Question

Can I enable turbo keys for combinations? For instance Shift + 1 could continually be pressing Shift + 1 until I let go as well?

Rebind AI

luau
-- rebind: name=Turbo Click & Keys
-- rebind: description=Rapid fire clicking and key combinations while held

local cfg = UI.Schema({
    cps = UI.Slider(10, { min = 1, max = 20, label = "Clicks Per Second" }),
    enabled = UI.Toggle(true, { label = "Enable" }),
    
    turbo_keys = UI.Text("Mouse1", {
        label = "Turbo Keys (comma-separated)",
        placeholder = "Mouse1, LShift+1, LCtrl+C",
        maxLength = 200,
    }),
})

local activeTask = nil
local activeTurboKey = nil

local function parseTurboKeys()
    local keys = {}
    for key in cfg.turbo_keys:gmatch("[^,]+") do
        key = key:match("^%s*(.-)%s*$") -- trim whitespace
        if key ~= "" then
            table.insert(keys, key)
        end
    end
    return keys
end

function OnDown(key)
    if not cfg.enabled then
        return true
    end

    local turboKeys = parseTurboKeys()
    for _, turboKey in ipairs(turboKeys) do
        if key:lower() == turboKey:lower():match("([^+]+)$") then -- match last key in combo
            activeTurboKey = turboKey
            activeTask = Run(function()
                while Input.IsDown(key) do
                    HID.Press(turboKey, 20)
                    Sleep(1000 / cfg.cps)
                end
            end)
            return false
        end
    end

    return true
end

function OnUp(key)
    if activeTurboKey and activeTask and activeTask:IsRunning() then
        activeTask:Cancel()
        activeTurboKey = nil
        return false
    end
    return true
end

function OnStop()
    if activeTask and activeTask:IsRunning() then
        activeTask:Cancel()
    end
end

function OnBlur()
    if activeTask and activeTask:IsRunning() then
        activeTask:Cancel()
    end
end

How it works

This enhanced version lets you configure any key or key combination for turbo firing:

Features:

  • The turbo_keys text field accepts comma-separated keys: Mouse1, LShift+1, LCtrl+C, Space
  • When you hold any of these keys, it repeatedly presses the full combination at your configured CPS
  • Works with modifiers: LCtrl+A, LShift+Enter, LAlt+F4, etc.
  • The script detects which key you pressed, looks it up in your turbo list, and fires the full combo
  • Whitespace is trimmed automatically so LShift + 1 works the same as LShift+1
  • Release any turbo key and it stops

Example configurations:

  • Mouse1 — turbo click
  • Mouse1, Space — turbo click + turbo space
  • LShift+1, LShift+2, LShift+3 — turbo numpad combos
  • LCtrl+C, LCtrl+V — rapid copy/paste
  • Mouse1, Mouse2 — turbo left and right click

The script matches only the last key in the combo (the actual key you pressed), so when you hold Shift+1, it detects the 1 press and fires LShift+1 repeatedly.

Learn more:

Question

Wow that's really cool.

Rebind AI

Thanks! Glad you like it. The combo support opens up a lot of possibilities — you can turbo fire ability hotkeys in games, rapid modifier + click for workflows, or even chain macros together.

If you want to take it further, you could:

  • Add a cooldown timer between turbo actions (useful for abilities with cast times)
  • Per-key CPS control — different click speeds for different keys
  • Burst mode — tap to fire N clicks instead of continuous hold
  • Key exclusions — prevent turbo on certain modifiers to avoid accidents

Feel free to ask if you want any of those features added, or if you hit any edge cases with the current version. Happy scripting!