Skip to content

Instantly share code, notes, and snippets.

@DuyNgao2306
Created May 1, 2026 16:39
Show Gist options
  • Select an option

  • Save DuyNgao2306/a7172589f96b6f7e8c303a9c093e5f8e to your computer and use it in GitHub Desktop.

Select an option

Save DuyNgao2306/a7172589f96b6f7e8c303a9c093e5f8e to your computer and use it in GitHub Desktop.
-- Anti AFK Script (LocalScript)
local Players = game:GetService("Players")
local VirtualUser = game:GetService("VirtualUser")
local player = Players.LocalPlayer
-- đảm bảo player đã load
if not player then
Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
player = Players.LocalPlayer
end
-- chống bị kick AFK
player.Idled:Connect(function()
-- giả lập tương tác người dùng
VirtualUser:CaptureController()
VirtualUser:ClickButton2(Vector2.new(0, 0))
end)
-- giữ script luôn chạy
while true do
task.wait(60) -- mỗi 60s kiểm tra 1 lần
if player then
-- có thể thêm debug nếu cần
-- print("Anti-AFK đang hoạt động")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment