
Key RequiredUniversal

local Players = game:GetService("Players")
local Lighting = game:GetService("Lighting")
local RunService = game:GetService("RunService")
local VirtualUser = game:GetService("VirtualUser")
local UIS = game:GetService("UserInputService")
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
local gui = Instance.new("ScreenGui")
gui.ResetOnSpawn = false
gui.IgnoreGuiInset = true
gui.Parent = player:WaitForChild("PlayerGui")
local black = Instance.new("Frame")
black.Parent = gui
black.Size = UDim2.fromScale(1,1)
black.BackgroundColor3 = Color3.fromRGB(0,0,0)
black.ZIndex = 5
black.Visible = false
local btn = Instance.new("TextButton")
btn.Parent = gui
btn.Size = UDim2.fromOffset(140,36)
btn.AnchorPoint = Vector2.new(1,0)
btn.BackgroundColor3 = Color3.fromRGB(25,25,25)
btn.TextColor3 = Color3.fromRGB(255,255,255)
btn.TextScaled = true
btn.Font = Enum.Font.SourceSansBold
btn.Text = "Anti AFK"
btn.ZIndex = 6
task.wait()
btn.Position = UDim2.fromOffset(gui.AbsoluteSize.X - 20, 60)
local blur = Instance.new("BlurEffect")
blur.Size = 0
blur.Parent = Lighting
local removedColorMaps = {}
local storedParts = {}
local disabledLights = {}
local disabledFX = {}
local function removeShaders()
for _,v in ipairs(Lighting:GetChildren()) do
if v:IsA("BloomEffect") or v:IsA("SunRaysEffect") or v:IsA("DepthOfFieldEffect") then
v.Enabled = false
elseif v:IsA("ColorCorrectionEffect") then
table.insert(removedColorMaps, v:Clone())
v:Destroy()
end
end
end
local function restoreShaders()
for _,v in ipairs(Lighting:GetChildren()) do
if v:IsA("BloomEffect") or v:IsA("SunRaysEffect") or v:IsA("DepthOfFieldEffect") then
v.Enabled = true
end
end
for _,cc in ipairs(removedColorMaps) do
cc.Parent = Lighting
end
removedColorMaps = {}
end
local function toggleLights(on)
for _,v in ipairs(workspace:GetDescendants()) do
if v:IsA("PointLight") or v:IsA("SpotLight") or v:IsA("SurfaceLight") then
if on then
if v.Enabled then
disabledLights[v] = true
v.Enabled = false
end
else
if disabledLights[v] then
v.Enabled = true
end
end
end
end
if not on then disabledLights = {} end
end
local function toggleFX(on)
for _,v in ipairs(workspace:GetDescendants()) do
if v:IsA("ParticleEmitter") or v:IsA("Trail") then
if on then
if v.Enabled then
disabledFX[v] = true
v.Enabled = false
end
else
if disabledFX[v] then
v.Enabled = true
end
end
end
end
if not on then disabledFX = {} end
end
local function potatoWorld(on)
for _, obj in ipairs(workspace:GetDescendants()) do
if obj:IsA("BasePart") then
if on then
storedParts[obj] = {obj.Material, obj.CastShadow}
obj.Material = Enum.Material.Plastic
obj.CastShadow = false
else
if storedParts[obj] then
obj.Material = storedParts[obj][1]
obj.CastShadow = storedParts[obj][2]
end
end
elseif obj:IsA("Texture") or obj:IsA("Decal") or obj:IsA("SurfaceAppearance") then
obj.Transparency = on and 1 or 0
end
end
if not on then storedParts = {} end
end
local afk = false
local freezeConn
local camConn
local oldWalk
local oldJump
local oldMinZoom
local oldMaxZoom
local oldCamType
local lockedCFrame
local function freezeChar(on)
local char = player.Character
if not char then return end
local hum = char:FindFirstChildOfClass("Humanoid")
local root = char:FindFirstChild("HumanoidRootPart")
if not hum or not root then return end
if on then
oldWalk = hum.WalkSpeed
oldJump = hum.JumpPower
oldMinZoom = player.CameraMinZoomDistance
oldMaxZoom = player.CameraMaxZoomDistance
oldCamType = camera.CameraType
lockedCFrame = camera.CFrame
hum.WalkSpeed = 0
hum.JumpPower = 0
root.Anchored = true
player.CameraMinZoomDistance = 10
player.CameraMaxZoomDistance = 10
camera.CameraType = Enum.CameraType.Scriptable
camConn = RunService.RenderStepped:Connect(function()
camera.CFrame = lockedCFrame
end)
else
hum.WalkSpeed = oldWalk or 16
hum.JumpPower = oldJump or 50
root.Anchored = false
player.CameraMinZoomDistance = oldMinZoom or 0.5
player.CameraMaxZoomDistance = oldMaxZoom or 400
if camConn then camConn:Disconnect() end
camera.CameraType = oldCamType or Enum.CameraType.Custom
end
end
local dragging = false
local dragStart
local startPos
local activeInput
btn.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
dragging = true
activeInput = input
dragStart = input.Position
startPos = btn.Position
end
end)
UIS.InputEnded:Connect(function(input)
if input == activeInput then
dragging = false
activeInput = nil
end
end)
UIS.InputChanged:Connect(function(input)
if dragging and input == activeInput then
local delta = input.Position - dragStart
local newX = startPos.X.Offset + delta.X
local newY = startPos.Y.Offset + delta.Y
local screen = gui.AbsoluteSize
local size = btn.AbsoluteSize
newX = math.clamp(newX, size.X, screen.X)
newY = math.clamp(newY, 0, screen.Y - size.Y)
btn.Position = UDim2.fromOffset(newX, newY)
end
end)
btn.MouseButton1Click:Connect(function()
afk = not afk
if afk then
btn.Text = "Back"
black.Visible = true
blur.Size = 24
removeShaders()
potatoWorld(true)
toggleLights(true)
toggleFX(true)
freezeChar(true)
freezeConn = RunService.RenderStepped:Connect(function()
RunService:Set3dRenderingEnabled(false)
end)
else
btn.Text = "Anti AFK"
black.Visible = false
blur.Size = 0
restoreShaders()
potatoWorld(false)
toggleLights(false)
toggleFX(false)
if freezeConn then freezeConn:Disconnect() end
RunService:Set3dRenderingEnabled(true)
freezeChar(false)
end
end)
player.CharacterAdded:Connect(function()
if afk then
task.wait(1)
freezeChar(true)
end
end)
player.Idled:Connect(function()
if afk then
VirtualUser:CaptureController()
VirtualUser:ClickButton2(Vector2.new())
end
end)



COOL
@Raffle_w thanks