ANTI AFK UNIVERSAL
Key RequiredUniversal

ANTI AFK UNIVERSAL

Universal Scriptmentazapmentazap 1K views 650 executesUpdated Jan 13, 2026
5.0/ 5(1 votes)
10100% Positive
Lua Script•148 lines (3652 chars)
print("🟢 AFK + WEBHOOK inicialized")

-- =====================
-- SERVICES
-- =====================
local Players = game:GetService("Players")
local VirtualUser = game:GetService("VirtualUser")
local TextChatService = game:GetService("TextChatService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local HttpService = game:GetService("HttpService")
local GuiService = game:GetService("GuiService")

local player = Players.LocalPlayer

-- =====================
-- CONFIG
-- =====================
local INTERVAL = 600
local HEARTBEAT = 60
local WEBHOOK = " your webhook here"

local req = request or http_request or (syn and syn.request)

-- =====================
-- HELPERS
-- =====================
local function formatTime(sec)
    local m = math.floor(sec / 60)
    local s = sec % 60
    return string.format("%02d:%02d", m, s)
end

-- =====================
-- ANTI IDLE
-- =====================
player.Idled:Connect(function()
    VirtualUser:CaptureController()
    VirtualUser:ClickButton2(Vector2.new(0,0))
end)

-- =====================
-- PASSINHO
-- =====================
local function tinyStep()
    local char = player.Character or player.CharacterAdded:Wait()
    local hum = char:WaitForChild("Humanoid")
    hum:Move(Vector3.new(0,0,1), true)
end

-- =====================
-- CHAT AFK
-- =====================
local function sendAFK()
    if TextChatService.ChatVersion == Enum.ChatVersion.TextChatService then
        local ch = TextChatService.TextChannels:FindFirstChild("RBXGeneral")
        if ch then ch:SendAsync("AFK") end
    else
        ReplicatedStorage
            :WaitForChild("DefaultChatSystemChatEvents")
            :WaitForChild("SayMessageRequest")
            :FireServer("AFK", "All")
    end
end

-- =====================
-- WEBHOOK
-- =====================
local startTime = os.time()
local messageId

local function webhookCreate()
    if not req then return end
    local res = req({
        Url = WEBHOOK .. "?wait=true",
        Method = "POST",
        Headers = {["Content-Type"] = "application/json"},
        Body = HttpService:JSONEncode({
            content = "🟢 **AFK FARM ACTIVE**\n⏱️ Tempo: 00:00"
        })
    })
    local body = HttpService:JSONDecode(res.Body)
    messageId = body.id
end

local function webhookUpdate()
    if not (req and messageId) then return end
    local elapsed = os.time() - startTime
    req({
        Url = WEBHOOK .. "/messages/" .. messageId,
        Method = "PATCH",
        Headers = {["Content-Type"] = "application/json"},
        Body = HttpService:JSONEncode({
            content = "🟢 **AFK FARM ACTIVE**\n⏱️ Tempo: " .. formatTime(elapsed)
        })
    })
end

local function webhookDelete()
    if not (req and messageId) then return end
    req({
        Url = WEBHOOK .. "/messages/" .. messageId,
        Method = "DELETE"
    })
end

-- =====================
-- START
-- =====================
task.wait(1)
tinyStep()
sendAFK()
webhookCreate()

-- =====================
-- LOOP AFK
-- =====================
task.spawn(function()
    while true do
        task.wait(INTERVAL)
        tinyStep()
        sendAFK()
    end
end)

-- =====================
-- HEARTBEAT
-- =====================
task.spawn(function()
    while true do
        task.wait(HEARTBEAT)
        print("💓 Anti-Afk Working")
        webhookUpdate()
    end
end)

-- =====================
-- DESCONEXÃO / FECHAMENTO
-- =====================
local function onShutdown()
    print("🔴 Desconected — Cleaning Discord")
    webhookDelete()
end

-- erro / kick
GuiService.ErrorMessageChanged:Connect(onShutdown)

-- fechar jogo normal
game:BindToClose(onShutdown)

Features & Information

This script works as follows: it's a normal anti-AFK, but with some added features. It has a webhook system on Discord; it sends a message wherever you want, and it appears there when you run it in any game. When you disconnect, whether by network or kick, the message sent via webhook is instantly deleted. In the game, a heartbeat log appears on F9, indicating whether it's active or not, sent every minute. On Discord, the webhook is updated every minute, and it sends AFK messages in the chat every ten minutes. I want to make it very clear that I didn't create this script; I did everything on ChatGPT in half an hour, so if any errors appear, it's not my fault.
#anti afk#anti#afk#away

Community Comments (6)

EmitheYurimewoEmitheYurimewoJan 14, 2026

Despite being made with AI, it is very good and it works very well!

Replying to @EmitheYurimewo
mentazapmentazapJan 15, 2026

@EmitheYurimewo Thank you, my friend. I don't know anything about coding; I'm just a user of what people who understand code do. As a user, I'd like a good anti-AFK script, so I made one with AI, tested it before sending it here, and I'm glad you liked it. This script is for all of us

raxixe32raxixe32Jan 15, 2026(edited)

nice script

raxixe32raxixe32Jan 15, 2026(edited)

i used for an game event, i got all perks, thank you so much, I went AFK for several hours and it worked perfectly.

Replying to @raxixe32
mentazapmentazapJan 15, 2026

@raxixe32 Hey bro, I'm the one who should thank you for using this script, and I'm glad I was able to help you achieve something in your game lol

BlackHZxxpBlackHZxxpJan 15, 2026

porque quando eu executei eu tomei ban de 3 anos e invadiram minha maquina?

More Scripts for Universal Scripts