05-06-26
Sniper Sensitivity with Hold Key
This Lua script for Rebind hardware input allows you to reduce mouse sensitivity while holding a key, perfect for sniper aiming. Configure the key and sensitivity percentage for precise control using
rebindlua scriptsnipersensitivitymousehardware inputscript
Question
Sniper button: lower sensitivity while held
Rebind AI
luau
-- rebind: min_sdk=0.1.0
-- rebind: name=Sniper Button
local cfg = UI.Schema({
sniper_key = UI.Keybind("Mouse2", { label = "Sniper Key" }),
sensitivity = UI.Slider(30, { min = 5, max = 95, suffix = "%", label = "Sniper Sensitivity" }),
})
function OnMove(dx, dy)
if Input.IsDown(cfg.sniper_key) then
local factor = cfg.sensitivity / 100
HID.Move(dx * factor, dy * factor)
return false
end
return true
endHow it works:
When you hold the sniper key (default: Mouse2 / right-click), all mouse movement is scaled down to your configured sensitivity percentage. This creates the classic "hold to zoom and slow down aiming" mechanic used in many games.
- Sniper Key: The button you hold to activate sniper mode (usually Mouse2 for right-click aim)
- Sniper Sensitivity: How much the mouse slows down (30% means 1/3 speed)
The script intercepts OnMove, scales the movement by the sensitivity factor, and blocks the original movement from reaching the PC.
Learn more