Smart AutoBlock
Key Required

Smart AutoBlock

FPE:SInnovatorInnovator 1.8K views 747 executesUpdated Jan 13, 2026
5.0/ 5(1 votes)
10100% Positive
Lua Script•94 lines (2750 chars)
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()

Features & Information

A simple AutoBlock for close-range attacks blocks most attacks although due to its logic it may sometimes block too early (sorry). IT DOES NOT WORK ON ALICE because I’m lazy. Also AutoBlock is only usable by the student. To disable the script, press "J", and press it again to re-enable.

Community Comments (2)

H4ck1ngbr0H4ck1ngbr0Aug 15, 2026

Wanna make an infinity castle script from demon slayer PLEASE?

H4ck1ngbr0H4ck1ngbr0Aug 15, 2026

🙏

More Scripts for FPE:S