AutoRejoin — Anti-AFK System
Keep your players in-game forever. No more idle kicks.
by coreshun
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The Problem
Roblox automatically kicks players after 20 minutes of inactivity. For idle games, tycoons, AFK farming games, and simulators — this kills your player retention and session time.
The Solution
AutoRejoin detects when a player has been idle for 18 minutes (2 minutes before the kick) and automatically teleports them back to the same server. The player never gets disconnected — they seamlessly rejoin with all progress intact.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Features
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
How It Works
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Installation
One step. That's it.
No server scripts. No modules. No configuration. It works immediately on publish.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Perfect For
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
What's Included
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Technical Details
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Support
Join our Discord: discord.gg/hdB5tadkk8
Or message coreshun on BuiltByBit.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Open source — fully readable and editable Luau code. No obfuscation.
Keep your players in-game forever. No more idle kicks.
by coreshun
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The Problem
Roblox automatically kicks players after 20 minutes of inactivity. For idle games, tycoons, AFK farming games, and simulators — this kills your player retention and session time.
The Solution
AutoRejoin detects when a player has been idle for 18 minutes (2 minutes before the kick) and automatically teleports them back to the same server. The player never gets disconnected — they seamlessly rejoin with all progress intact.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Features
- Smart Idle Detection — Tracks mouse, keyboard, and touch input. Timer resets on any activity.
- Same-Server Rejoin — Uses TeleportToPlaceInstance to return the player to the exact same server, not a random one.
- Fallback Teleport — If same-server fails (server closed), falls back to any available server.
- Studio Detection — Automatically disables in Roblox Studio (TeleportService doesn't work there). No errors in your output.
- Retry Logic — 3 attempts for same-server, 3 attempts for any-server. Robust against transient failures.
- Lightweight — Single LocalScript, no dependencies, no server-side code needed.
- Zero Configuration — Drop it in and it works. No setup, no remotes, no datastores.
- Mobile + PC + Console — Works on all platforms. Touch input tracked for mobile.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
How It Works
Code:
Player joins game
↓
Script starts tracking input (mouse, keyboard, touch)
↓
Every 10 seconds: check time since last input
↓
If idle ≥ 18 minutes:
↓
Attempt 1: TeleportToPlaceInstance (same server)
↓ (if fails)
Attempt 2: Teleport (any server)
↓
Player is back in-game — no disconnect!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Installation
One step. That's it.
- Place the AutoRejoin script in
StarterPlayerScriptsas a LocalScript
No server scripts. No modules. No configuration. It works immediately on publish.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Perfect For
- Idle / Clicker games
- Tycoon games
- AFK farming games
- Simulators with passive income
- Any game where players leave it running
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
What's Included
- AutoRejoin (LocalScript) — the complete anti-AFK system, single file
- README — installation guide and feature overview
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Technical Details
- Script Type: LocalScript
- Placement: StarterPlayerScripts
- Dependencies: None
- Services Used: UserInputService, TeleportService, Players, RunService
- Idle Threshold: 18 minutes (configurable — change IDLE_LIMIT variable)
- Check Interval: Every 10 seconds
- Retry Attempts: 3 same-server + 3 any-server
- Performance Impact: Negligible (one timer check every 10s)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Support
Join our Discord: discord.gg/hdB5tadkk8
Or message coreshun on BuiltByBit.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Open source — fully readable and editable Luau code. No obfuscation.
