Advertisement
ReplyIsHere

Untitled

Apr 12th, 2025 (edited)
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.30 KB | None | 0 0
  1. -- Anti-AFK Script with GUI
  2.  
  3. local function createGUI()
  4.     -- Create a ScreenGui
  5.     local screenGui = Instance.new("ScreenGui")
  6.     screenGui.Parent = game.Players.LocalPlayer.PlayerGui
  7.  
  8.     -- Create a frame for the GUI
  9.     local frame = Instance.new("Frame")
  10.     frame.Parent = screenGui
  11.     frame.Size = UDim2.new(0, 300, 0, 100)
  12.     frame.Position = UDim2.new(0.5, -150, 0.5, -50)
  13.     frame.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  14.  
  15.     -- Create a label for the GUI
  16.     local label = Instance.new("TextLabel")
  17.     label.Parent = frame
  18.     label.Size = UDim2.new(1, 0, 1, 0)
  19.     label.BackgroundTransparency = 1
  20.     label.Text = "Anti-AFK: Enabled"
  21.     label.TextColor3 = Color3.fromRGB(255, 255, 255)
  22.     label.TextScaled = true
  23.  
  24.     -- Create a toggle button
  25.     local toggleButton = Instance.new("TextButton")
  26.     toggleButton.Parent = frame
  27.     toggleButton.Size = UDim2.new(0.8, 0, 0.2, 0)
  28.     toggleButton.Position = UDim2.new(0.1, 0, 0.7, 0)
  29.     toggleButton.Text = "Toggle AFK"
  30.     toggleButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
  31.     toggleButton.TextColor3 = Color3.fromRGB(0, 0, 0)
  32.  
  33.     -- Variable to track if Anti-AFK is enabled or disabled
  34.     local isAntiAFKEnabled = true
  35.  
  36.     -- Toggle the Anti-AFK feature
  37.     toggleButton.MouseButton1Click:Connect(function()
  38.         isAntiAFKEnabled = not isAntiAFKEnabled
  39.         if isAntiAFKEnabled then
  40.             label.Text = "Anti-AFK: Enabled"
  41.             toggleButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
  42.         else
  43.             label.Text = "Anti-AFK: Disabled"
  44.             toggleButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  45.         end
  46.     end)
  47.  
  48.     -- Function to handle Anti-AFK behavior
  49.     local function antiAFK()
  50.         while isAntiAFKEnabled do
  51.             -- Jump every 10 seconds
  52.             game:GetService("Players").LocalPlayer.Character:WaitForChild("Humanoid").Jump = true
  53.             wait(10) -- 10-second delay
  54.         end
  55.     end
  56.  
  57.     -- Start the Anti-AFK loop
  58.     spawn(antiAFK)
  59. end
  60.  
  61. -- Queue on teleport to load the script across all servers
  62. pcall(function()
  63.     if queueonteleport then
  64.         queueonteleport([[
  65.             loadstring(game:HttpGet("https://pastebin.com/raw/62pxDit4"))()
  66.         ]])
  67.     end
  68. end)
  69.  
  70. -- Create the GUI when the player joins
  71. createGUI()
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement