Every other AFK script in FiveM is a punishment: a timer, a warning, a kick. This one does the opposite. A player who sits still in a vehicle has their camera taken over by a cinematic orbit of their car — depth of field, cuts that land on the beat, music underneath. Touch any control and they are back in the driver's seat instantly.
Nobody is kicked, warned, or timed out. Ever.
- 11
- camera shots included
- 30s
- default idle before the camera takes over
- 0
- players kicked, warned, or timed out
- 1
- dependency — tLib, and it's free
Will it run on your server?
- OneSync, Infinity or Legacy.
- tLib v0.4 or newer — free, and the only dependency. Start it before tAFK.
- No framework needed. There is no framework code in it at all — nothing to detect, nothing to wire up.
- No ports, no external services.
- Vehicles only. The cinematic triggers in a car, bike, boat, or aircraft. There is no on-foot camera, and
/afkoutside a vehicle just tells the player to get in one.
Try it before you buy it
See it on the test server
Press F8 in FiveM, paste the line below, and press enter. Get in any vehicle and run /afk to trigger it on demand — or just sit still for 30 seconds and let it happen on its own.
What you get
A camera, not a kick
Idle in a vehicle and the screen fades, the HUD hides, and the camera moves to a chosen angle on the car. Shots cut from one to the next for as long as the player is away. Any input at all — steering, throttle, even a nudge of the mouse — fades them straight back to gameplay, including part-way through the fade.
Author shots by flying the camera
/tafkedit freezes your car and drops you into a free-fly camera around it. Fly to where the shot should begin and press 1. Move to where it should end and press 2. Press 3 to preview, 4 to save.
Saving pushes it to every connected player straight away. Naming, per-shot toggles, depth of field, and whether a shot is global or locked to that one vehicle model all live in the same overlay.
The director picks the shot, not a shuffle
Before every cut, each candidate shot is raycast — along its path and at both ends. Angles that clip the car, sit too close, are blocked by a trailer, repeat something from the last three cuts, or start far from where the previous shot ended all lose points. Whatever survives goes into a weighted draw.
Shot offsets scale to the vehicle as well, from 0.8× to 2.5× of its bounding box, so one shot frames a motorbike and an articulated truck without being re-authored.
Cuts land on the beat
The interface analyses the playing track in the browser, finds its tempo, and hands the timing back to the game. Each shot is then held for the beat-aligned length closest to a random target, with an anticipation offset so the cut lands with the beat rather than just after it.
The music is yours: drop any .ogg, .mp3, or .wav into audio/ and it joins the rotation on the next restart. No naming convention, no manifest. If a track's tempo can't be read, shot lengths fall back to random and everything else carries on working.
Every player owns their settings
/tafk gives each player a master switch, music and volume overrides, a hide-HUD toggle, and per-shot opt-outs. All of it survives a relog. Your server settings are the starting point; a player's own choice wins on their machine.
Vehicles can bring their own shots
A vehicle resource can ship shots for its own model by adding one line to its manifest:
tafk_config 'tafk.json'Every running resource is scanned at boot and whenever one starts, and matching shots are merged in automatically. Your own edits always win over a pack's.
Also included
- Live admin settings. Idle timeout, shot length bounds, beat offset, and music defaults, changed from in game and applied without a restart.
- A state bag, not an integration.
Player(src).state.afkis readable from anywhere — nothing to wire up for the common case. - Six exports for everything else:
IsAFK,IsAFKEnabled,StartAFK,StopAFK,ToggleAFK,SetAFKEnabled. - A suppression hook.
SetAFKEnabled(false)keeps the camera out of your races, minigames, and cutscenes for the session. - It knows when not to fire. Cutscenes, player switches, and a ragdolled ped all block it.
Specifications
Compatibility
What is included
/tafkedit — free-fly camera, keyframe capture, live preview/tafk — per player, persisted across relogs.ogg / .mp3 / .wavExtending it
Player(src).state.afk — true / false / niltafk:stateChanged eventdata.json (shots and settings) and the whole audio/ folderBuying it
Questions people actually ask
Will this kick my idle players?
No — there is no timer, no warning, and no kick anywhere in it. It only changes the camera. If
you do want session enforcement, run a kick script alongside it and have that script read
Player(src).state.afk.
Does it work on foot?
No. Vehicles only. A player standing outside a car who runs /afk is told to get in one. If an
on-foot idle camera is what you need, this is not it.
Do I have to edit a config file to add camera angles?
No, and you shouldn't. Shots are captured in game with /tafkedit and saved from that overlay,
which pushes them live. data.json is only read at start, so hand-edits need a restart tAFK.
Do I have to use your music?
No. Drop your own files into audio/ — any filename works, and the folder is scanned at start.
Delete what's there and it's gone. Beat sync reads whatever happens to be playing.
Can a player turn it off for themselves?
Yes, in /tafk, and the choice survives relogs. They can also mute the music, keep their HUD,
or opt out of individual shots without disabling the rest.
Will it interrupt my race script or my cutscene?
Call exports['tAFK']:SetAFKEnabled(false) when yours starts and true when it ends — that
also cancels a cinematic already running. Cutscenes, player switches, and ragdolls are blocked
automatically.
Still not sure?
The documentation is public — installation, the editor, the full data.json schema,
and the API. Read it before you spend anything, or ask in the
Discord.
