Anti-AFK

@rebind / anti-afkv0.1.2Public

Takes a tiny step every few minutes so the server never kicks you for idling.

Files

Older release. Installs get 0.1.2.

main.luau1.1 KB

-- Anti-AFK: every few minutes, tap forward then back so the server never
-- sees you idle. The toggle key starts and stops it.

local cfg = UI.Schema({
  toggle = UI.Keybind("F6", { label = "Start or stop" }),
  minutes = UI.Slider(4, {
    min = 1,
    max = 15,
    suffix = " min",
    label = "Nudge every",
  }),
  autostart = UI.Toggle(false, {
    label = "Start nudging when the package starts",
  }),
})

local task = nil

local function stop()
  if task then
    task:Cancel()
    task = nil
  end
  HID.Up("W")
  HID.Up("S")
end

local function start()
  task = Run(function()
    while true do
      Sleep(cfg.minutes * 60000 + Math.Random(0, 20000))
      HID.Press("W", Math.Random(60, 140))
      HID.Press("S", Math.Random(60, 140))
    end
  end)
end

Bind(cfg.toggle, function()
  if task then
    stop()
    UI.Notify("Anti-AFK off", "info")
  else
    start()
    UI.Notify("Anti-AFK on", "success")
  end
end)

function OnStart()
  if cfg.autostart then
    start()
    UI.Notify("Anti-AFK on", "success")
  end
end

function OnStop()
  stop()
end

3 files, 2.7 KB.