05-03-26
Rapid Click Auto-Pistol Script
This Lua script for Rebind hardware input allows you to rapidly click a mouse button when held down, simulating an auto-pistol. Configure the clicks per second and enable/disable the script with a tog
rebindlua scriptrapid clickauto-pistolhardware inputscriptmouse
Question
Auto-pistol rapid click on hold
Rebind AI
luau
-- rebind: name=Auto-Pistol Rapid Click
local cfg = UI.Schema({
enabled = UI.Toggle(true, { label = "Enable" }),
cps = UI.Slider(10, { min = 1, max = 20, label = "Clicks Per Second" }),
hotkey = UI.Keybind("Mouse1", { label = "Hold to Fire" }),
})
local task = nil
function OnDown(key)
if not cfg.enabled or key ~= cfg.hotkey then
return true
end
task = Run(function()
local interval = 1000 / cfg.cps
while Input.IsDown(cfg.hotkey) do
HID.Press("Mouse1", 20)
Sleep(interval)
end
end)
return false
end
function OnUp(key)
if key == cfg.hotkey and task then
task:Cancel()
task = nil
return false
end
return true
end
function OnBlur()
if task and task:IsRunning() then
task:Cancel()
task = nil
end
end
function OnStop()
if task and task:IsRunning() then
task:Cancel()
end
endHow it works:
Hold the configured hotkey (default: Mouse1) to trigger rapid clicks at the specified rate (1–20 clicks per second). The script polls Input.IsDown() inside a Run() loop, firing a new click every interval. When you release the key, the loop exits and the task cancels.
- cps slider: Adjust clicks per second
- enabled toggle: Turn the feature on/off globally
- OnBlur cleanup: Cancels any active firing when the window loses focus
Learn more