local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local Workspace = game:GetService("Workspace") local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoidRootPart = character:WaitForChild("HumanoidRootPart") local detentoin = 25 local enabled = true local connection = nil local lastPressTime = 0 local COOLDOWN = 1.3 local function pressQ() local currentTime = tick() if currentTime - lastPressTime < COOLDOWN then return end local virtualInputManager = game:GetService("VirtualInputManager") virtualInputManager:SendKeyEvent(true, Enum.KeyCode.Q, false, game) virtualInputManager:SendKeyEvent(false, Enum.KeyCode.Q, false, game) lastPressTime = currentTime end local function checkSoundPlaying(sound) if not sound then return false end if sound:IsA("Sound") then if sound.IsLoaded and sound.TimeLength > 0 then return sound.TimePosition > 0 and sound.TimePosition < sound.TimeLength end return sound.Playing end return false end local function checkForSwing() if not character or not humanoidRootPart then return end local myPosition = humanoidRootPart.Position local teachersFolder = Workspace:FindFirstChild("Teachers") if not teachersFolder then return end for _, teacher in pairs(teachersFolder:GetChildren()) do if teacher:IsA("Model") then local teacherRoot = teacher:FindFirstChild("HumanoidRootPart") if teacherRoot then local distance = (teacherRoot.Position - myPosition).Magnitude if distance > detentoin then continue end for _, sound in pairs(teacher:GetDescendants()) do if sound.Name == "SwingSFX" and checkSoundPlaying(sound) then pressQ() return end end end end end end local function startLoop() if connection then connection:Disconnect() end connection = game:GetService("RunService").Heartbeat:Connect(function() if enabled then checkForSwing() end end) end local function onCharacterAdded(newCharacter) character = newCharacter humanoidRootPart = newCharacter:WaitForChild("HumanoidRootPart") end player.CharacterAdded:Connect(onCharacterAdded) local function onInputBegan(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.J then enabled = not enabled end end UserInputService.InputBegan:Connect(onInputBegan) startLoop()