local UserInputService = game:GetService("UserInputService") local Players = game:GetService("Players") local VirtualInputManager = game:GetService("VirtualInputManager") local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoidRootPart = character:WaitForChild("HumanoidRootPart") -- GUI 設置 local screenGui = Instance.new("ScreenGui") screenGui.Parent = player:WaitForChild("PlayerGui") screenGui.ResetOnSpawn = false -- AFK 按鈕 local afkButton = Instance.new("TextButton") afkButton.Parent = screenGui afkButton.Size = UDim2.new(0.25, 0, 0.1, 0) afkButton.Position = UDim2.new(0.4, 0, 0.8, 0) afkButton.BackgroundColor3 = Color3.fromRGB(0, 170, 255) afkButton.Text = "AFK: OFF" afkButton.TextScaled = true afkButton.TextColor3 = Color3.fromRGB(255, 255, 255) local uiCorner = Instance.new("UICorner") uiCorner.CornerRadius = UDim.new(0.3, 0) uiCorner.Parent = afkButton local uiStroke = Instance.new("UIStroke") uiStroke.Thickness = 3 uiStroke.Color = Color3.fromRGB(0, 0, 0) uiStroke.Parent = afkButton -- 拖動按鈕 local dragging, dragStart, startPos afkButton.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = afkButton.Position end end) afkButton.InputChanged:Connect(function(input) if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then local delta = input.Position - dragStart afkButton.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end end) afkButton.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = false end end) -- AFK 變數 local afkEnabled = false -- 防掉線的函數 local function preventKick() while afkEnabled do if humanoidRootPart then humanoidRootPart.CFrame = humanoidRootPart.CFrame * CFrame.Angles(0, math.rad(10), 0) end VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.Space, false, nil) wait(1) VirtualInputManager:SendKeyEvent(false, Enum.KeyCode.Space, false, nil) wait(math.random(60, 120)) -- 1 到 2 分鐘跳一次 end end -- AFK 開關 afkButton.MouseButton1Click:Connect(function() afkEnabled = not afkEnabled if afkEnabled then afkButton.Text = "AFK: ON" afkButton.BackgroundColor3 = Color3.fromRGB(0, 255, 127) preventKick() else afkButton.Text = "AFK: OFF" afkButton.BackgroundColor3 = Color3.fromRGB(0, 170, 255) end end)