How do i make an Anti AFK Kick

I want a system like blade ball where you are AFK and you earn rewards without getting kicked for being AFK, but idk how do i make that

3 Likes

Search before posting

That’s not what OP asked. OP asked how to make an anti afk which stops people form being kicked after 20 minutes of being AFK, and you just posted how to detect if someone is afk. Please actually read the question before telling someone to search before posting.

Anyway, you can achieve this functionality using TeleportService, and teleporting the player back to the server after they have been AFK for a long time, eg. 10-15 minutes.

local function rejoin()
-- Make the player rejoin using TeleportService.
end

local idle = false
local timer  = 0
uis.InputEnded:Connect(function()
      idle = true
      while wait(1) do
            timer += 1
            if not idle then
               break
            end
            if timer >= 900 then
               rejoin()
               break
            end
      end
end)
uis.InputBegan:Connect(function()
      idle = false
end)

This isn’t exact code on how to completely achieve your goal, but I hope it will help you.

Alternatively, you can try to use VirtualUser service, although I believe it is deprecated.

5 Likes

I found a post that talked about similar to this and the solution for that referenced the one I sent, and that one linked to one that was unrelated so mb

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.