---
title: "Anti afk lol | Universal Roblox Script - ScriptBlox"
description: "Anti afk lol for any Roblox game: --[[ WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your own risk! ]] -- Anti Afk System..."
canonical_url: "https://scriptblox.com/script/Universal-Script-Anti-afk-lol-28917"
meta:
  "og:description": "Anti afk lol for any Roblox game: --[[ WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your own risk! ]] -- Anti Afk System..."
  "og:image": "https://scriptblox.com/images/script/8248339-1739038254706.png"
  "og:title": "Anti afk lol | Universal Roblox Script - ScriptBlox"
  "twitter:description": "Anti afk lol for any Roblox game: --[[ WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your own risk! ]] -- Anti Afk System..."
  "twitter:image": "https://scriptblox.com/images/script/8248339-1739038254706.png"
  "twitter:title": "Anti afk lol | Universal Roblox Script - ScriptBlox"
---

> Index of every page on this site: [llms.txt](https://scriptblox.com/llms.txt)

![Universal Script 📌](https://scriptblox.com/images/script/8248339-1739038254706.png)

# **Anti afk lol**

[**Universal Script 📌**](https://scriptblox.com/game/universal)**![gassanhassan474](https://scriptblox.com/images/photo/679bc3d03c4c3155ee2547cd-1740146093384.png) [gassanhassan474](https://scriptblox.com/u/gassanhassan474)**

2 years ago

[**Get an executor**](https://scriptblox.com/executors?kind=executor)

Please login to perform these actions:

## **Does it work? **

**No reports yet **

No reports yet. Tried it? Be the first to say.

Also noticed:

## Description

--\[\[ WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your own risk! ]] -- Anti Afk System local Players = game:GetService("Players") local CoreGui = game:GetService("CoreGui") local VirtualUser = game:GetService("VirtualUser") local RunService = game:GetService("RunService") local LocalPlayer = Players.LocalPlayer -- Create ScreenGui local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "AntiAFKGui" ScreenGui.ResetOnSpawn = false -- Try to insert GUI into CoreGui (more secure) or PlayerGui local success, \_ = pcall(function() ScreenGui.Parent = CoreGui end) if not success then ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui") end -- Create Frame local MainFrame = Instance.new("Frame") MainFrame.Name = "MainFrame" MainFrame.Size = UDim2.new(0, 200, 0, 100) MainFrame.Position = UDim2.new(0.8, 0, 0.1, 0) MainFrame.BackgroundColor3 = Color3.fromRGB(45, 45, 45) MainFrame.BorderSizePixel = 0 MainFrame.Parent = ScreenGui -- Create Corner local Corner = Instance.new("UICorner") Corner.CornerRadius = UDim.new(0, 10) Corner.Parent = MainFrame -- Create Title local Title = Instance.new("TextLabel") Title.Name = "Title" Title.Size = UDim2.new(1, 0, 0, 30) Title.Position = UDim2.new(0, 0, 0, 0) Title.BackgroundTransparency = 1 Title.Text = "Anti-AFK System" Title.TextColor3 = Color3.fromRGB(255, 255, 255) Title.TextSize = 16 Title.Font = Enum.Font.SourceSansBold Title.Parent = MainFrame -- Create Status Label local Status = Instance.new("TextLabel") Status.Name = "Status" Status.Size = UDim2.new(1, 0, 0, 30) Status.Position = UDim2.new(0, 0, 0.4, 0) Status.BackgroundTransparency = 1 Status.Text = "Status: Active" Status.TextColor3 = Color3.fromRGB(0, 255, 0) Status.TextSize = 14 Status.Font = Enum.Font.SourceSans Status.Parent = MainFrame -- Create Time Label local TimeLabel = Instance.new("TextLabel") TimeLabel.Name = "TimeLabel" TimeLabel.Size = UDim2.new(1, 0, 0, 30) TimeLabel.Position = UDim2.new(0, 0, 0.7, 0) TimeLabel.BackgroundTransparency = 1 TimeLabel.Text = "Time Active: 0s" TimeLabel.TextColor3 = Color3.fromRGB(255, 255, 255) TimeLabel.TextSize = 14 TimeLabel.Font = Enum.Font.SourceSans TimeLabel.Parent = MainFrame -- Make Frame Draggable local UserInputService = game:GetService("UserInputService") local dragging local dragInput local dragStart local startPos local function update(input) local delta = input.Position - dragStart MainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y) end MainFrame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = MainFrame.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) MainFrame.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then dragInput = input end end) UserInputService.InputChanged:Connect(function(input) if input == dragInput and dragging then update(input) end end) -- Anti-AFK System local startTime = tick() local connection local function updateTime() local currentTime = tick() - startTime local seconds = math.floor(currentTime % 60) local minutes = math.floor((currentTime / 60) % 60) local hours = math.floor(currentTime / 3600) TimeLabel.Text = string.format("Time Active: %02d:%02d:%02d", hours, minutes, seconds) end -- Anti-AFK Function local function antiAFK() local lastMove = tick() -- Connect to PreRender for smoother updates connection = RunService.PreRender:Connect(function() updateTime() -- Simulate activity every 15 minutes if tick() - lastMove >= 15 \* 60 then pcall(function() VirtualUser:CaptureController() VirtualUser:ClickButton2(Vector2.new()) Status.Text = "Status: Simulating Activity" Status.TextColor3 = Color3.fromRGB(255, 165, 0) wait(0.1) Status.Text = "Status: Active" Status.TextColor3 = Color3.fromRGB(0, 255, 0) end) lastMove = tick() end end) end -- Handle Player Focus LocalPlayer.Idled:Connect(function() VirtualUser:Button2Down(Vector2.new(0,0), workspace.CurrentCamera.CFrame) wait(1) VirtualUser:Button2Up(Vector2.new(0,0), workspace.CurrentCamera.CFrame) end) -- Start Anti-AFK antiAFK() -- Cleanup on script end ScreenGui.Destroying:Connect(function() if connection then connection:Disconnect() end end)

## **Updates **

1. Mar 27, 2025

   ****Script edited:**** Create script

[View Raw](https://scriptblox.com/raw/Universal-Script-Anti-afk-lol-28917)

```
--[[
	WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your own risk!
]]
-- Anti Afk System
local Players = game:GetService("Players")
local CoreGui = game:GetService("CoreGui")
local VirtualUser = game:GetService("VirtualUser")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer

-- Create ScreenGui
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "AntiAFKGui"
ScreenGui.ResetOnSpawn = false

-- Try to insert GUI into CoreGui (more secure) or PlayerGui
local success, _ = pcall(function()
    ScreenGui.Parent = CoreGui
end)
if not success then
    ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui")
end

-- Create Frame
local MainFrame = Instance.new("Frame")
MainFrame.Name = "MainFrame"
MainFrame.Size = UDim2.new(0, 200, 0, 100)
MainFrame.Position = UDim2.new(0.8, 0, 0.1, 0)
MainFrame.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
MainFrame.BorderSizePixel = 0
MainFrame.Parent = ScreenGui

-- Create Corner
local Corner = Instance.new("UICorner")
Corner.CornerRadius = UDim.new(0, 10)
Corner.Parent = MainFrame

-- Create Title
local Title = Instance.new("TextLabel")
Title.Name = "Title"


```

## **Comments **

**1**

Log in to join the conversation. [**Login **](https://scriptblox.com/login?redirect=/script/Universal-Script-Anti-afk-lol-28917)

![v12x's profile picture](https://scriptblox.com/images/photo/655520c724b36c811b990118-1715300970591.jpg)

[**v12x**](https://scriptblox.com/u/v12x)2 years ago(edited)

chat gpt ahh

1

```json
{"@context":"https://schema.org","@type":"SoftwareSourceCode","@id":"https://scriptblox.com/script/Universal-Script-Anti-afk-lol-28917#script","url":"https://scriptblox.com/script/Universal-Script-Anti-afk-lol-28917","name":"Anti afk lol","programmingLanguage":"Lua","runtimePlatform":"Roblox","author":{"@type":"Person","name":"gassanhassan474","url":"https://scriptblox.com/u/gassanhassan474"},"datePublished":"2025-02-08T18:10:54.760Z","image":"https://scriptblox.com/images/script/8248339-1739038254706.png"}
```

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://scriptblox.com/#website","@type":"WebSite","description":"Search free Roblox scripts uploaded by the community, with live status for every major executor. Browse by game, copy the loadstring and run it in your executor.","inLanguage":"en","name":"ScriptBlox","url":"https://scriptblox.com/"},{"@id":"https://scriptblox.com/script/Universal-Script-Anti-afk-lol-28917#webpage","@type":"WebPage","description":"Anti afk lol for any Roblox game: --[[ WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your own risk! ]] -- Anti Afk System...","name":"Anti afk lol | Universal Roblox Script - ScriptBlox","url":"https://scriptblox.com/script/Universal-Script-Anti-afk-lol-28917","breadcrumb":{"@id":"https://scriptblox.com/script/Universal-Script-Anti-afk-lol-28917#breadcrumb"},"isPartOf":{"@id":"https://scriptblox.com/#website"},"mainEntity":{"@id":"https://scriptblox.com/script/Universal-Script-Anti-afk-lol-28917#script"},"potentialAction":[{"@type":"ReadAction","target":["https://scriptblox.com/script/Universal-Script-Anti-afk-lol-28917"]}]},{"@id":"https://scriptblox.com/script/Universal-Script-Anti-afk-lol-28917#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://scriptblox.com","position":1},{"@type":"ListItem","name":"Universal","item":"https://scriptblox.com/game/universal","position":2},{"@type":"ListItem","name":"Anti afk lol","position":3}]}]}
```

## Sitemap

See the full [sitemap](https://scriptblox.com/sitemap.md) for all pages.
