Installation
How to install tAFK, grant admin access, and confirm the resource is running.
Prerequisites
- FiveM server with OneSync enabled (Infinity or Legacy)
- tLib — install the release zip, not the source code (source lacks built files). tAFK depends on it for Discovery, KVP, dialogs, toasts, and admin ACE
- Lua 5.4 (the manifest already declares
lua54 'yes')
Replaces tommys-afk
tAFK is the successor to the older tommys-afk script. If you had that installed, remove it before starting tAFK — the resource name, exports, and state-changed event are all different (tafk:stateChanged instead of tommys-afk:stateChanged).
Install
Extract the resource
Drop the tAFK folder into your server's resources directory. If you group resources (e.g., [tScripts]), place it alongside them.
Start tLib before tAFK
Order matters — tAFK resolves tLib exports and Discovery at load time.
ensure tLib
ensure tAFKGrant admin access
The editor, global settings, sequence management, and music-track registration all require tLib's admin ACE. Add it to any group that should be able to author sequences or tune server-wide defaults:
add_ace group.admin tlib.admin allowAdmins can:
- Open
/tafkedit(or the Open Sequence Editor button in/tafk, visible when in a vehicle) - Manage sequences — list, enable/disable, create, edit, delete — all inside the editor overlay
- Adjust global settings via Server Defaults (idle timeout, duration bounds, beat anchor, music defaults)
Non-admins see only the player-facing section of /tafk — their own overrides, sequence opt-outs, and a toggle button.
Start the server
On first run tAFK creates data.json at the resource root, seeded with 11 default sequences and 5 bundled music tracks. No further setup is required.
Quick start: see it in action
Goal: get the camera orbiting your vehicle in under a minute.
Spawn a vehicle
Any vehicle — AFK works on cars, bikes, boats, aircraft.
Stop moving
Sit still. After 30 seconds of no input (movement, mouse, keys), tAFK fades out and drops into the first sequence.
Or trigger it manually
Type /afk to skip the timer. The same fade → cinematic sequence plays immediately.
Hit any input to exit
Any key, mouse move, gamepad stick — instant cancel, fade back to gameplay.
From here, see:
- Usage guide — all commands, the
/tafkdialog, state-bag integration - Editor guide — author your own camera sequences in-game
- Configuration —
data.jsonschema, per-vehicle packs, admin options
File layout
| Path | Purpose |
|---|---|
fxmanifest.lua | Resource manifest — declares tLib dependency and the tafk_config Discovery metadata key |
data.json | Settings, sequences, music tracks, vehicleConfigs (auto-generated) |
shared/utils.lua | Log helper, camera math, tafkToVec3 decoder |
shared/schema.lua | Default settings + sequences + validators |
server/sv_store.lua | data.json read/write with read-merge-write to coexist with Discovery |
server/sv_discovery.lua | tLib Discovery instance for tafk_config → vehicleConfigs section |
server/sv_admin.lua | ACE-gated event handlers (save, toggle, register track, etc.) |
client/cl_bridge.lua | Receives server config + vehicle configs, exposes merged getters |
client/cl_camera.lua | AFK lifecycle, camera render, state-bag broadcast |
client/cl_director.lua | Weighted sequence selection with raycast penalties |
client/cl_detector.lua | Idle detection, exit conditions, auto-AFK timer |
client/cl_music.lua | NUI music bridge + beat-data callback |
client/cl_editor.lua | Orbit-camera keyframe editor + NUI callbacks |
client/cl_settings.lua | /tafk dialog (player prefs + admin sub-dialogs) |
client/ui/ | Built NUI assets (do not edit) |
client/web/ | NUI source (SolidJS + Vite + UnoCSS) |
audio/ | Music tracks (.ogg/.mp3/.wav) |
Do not edit `client/ui/`
These are built NUI assets. Source for the editor HUD and music player lives in client/web/. Build with bun run build from client/web/.
Verifying the install
After starting the server, look for this in the console:
[tAFK] loaded: 11 sequences, 5 music tracks discovered, v1(Music-tracks count reflects .ogg/.mp3/.wav files discovered in tAFK/audio/ — either name-matched by pattern or listed in audio/manifest.txt. See Configuration → Music tracks.)
On the client, after resource start:
[tAFK] cinematic camera system loaded
[tAFK] config received: 11 sequences, 5 tracksIf the player has the tafk:enabled KVP flag set (from a previous /tafk toggle), you'll also see:
[tAFK] AFK disabled by player preferenceThat's the normal path for a player who previously opted out.
