Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Basic Anti-Afk script
- getgenv().afk6464 = true -- true = ON, false = OFF
- local player = game.Players.LocalPlayer
- local VirtualUser = game:GetService("VirtualUser")
- local connection
- local function enableAntiAFK()
- if not connection then
- print("anti-afk ON")
- connection = player.Idled:Connect(function()
- if getgenv().afk6464 then
- VirtualUser:CaptureController()
- VirtualUser:ClickButton2(Vector2.new())
- end
- end)
- end
- end
- local function disableAntiAFK()
- if connection then
- connection:Disconnect()
- connection = nil
- print("Anti-AFK OFF")
- end
- end
- local function loop()
- while true do
- if getgenv().afk6464 then
- enableAntiAFK()
- else
- disableAntiAFK()
- end
- wait(1)
- end
- end
- spawn(loop)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement