Skip to content
home/templates/afk detector
utilityIntermediatemc 1.20.x – 1.21.x13 lines

afk detector

marks a player as afk after 5 minutes of no movement. announces when they go afk and return.

vanilla Skriptno addons required.
afk-detector.sk13 lines
on move:
    if {afk.%uuid of player%} is true:
        set {afk.%uuid of player%} to false
        broadcast "&7%player% &fis no longer AFK."
    set {afk.last.%uuid of player%} to now

every 30 seconds:
    loop all players:
        if {afk.%uuid of loop-player%} is not true:
            if difference between {afk.last.%uuid of loop-player%} and now is greater than 5 minutes:
                set {afk.%uuid of loop-player%} to true
                broadcast "&7%loop-player% &fis now AFK."

get it running

afk-detector.sk · 13 lines · vanilla Skript
  1. 1

    copy or download

    grab the .sk file with the buttons up top.

    afk-detector.sk· ready to drop in
  2. 2

    drop it in your scripts folder

    save it exactly here on your server — no typos, just copy the path:

    …/plugins/Skript/scripts/afk-detector.sk
  3. 3

    reload in-game

    run this in chat or console — your script goes live instantly:

    /sk reload afk-detector
that's it — your script is live. hop in-game to try it.
/ related templates

more utility templates

comments