Further enhance and make it block in multiple hit directions with precision and also add in an advanced false-state blocking with timing.

``
-- Super Advanced Auto Block Script for Saber Showdown
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local StarterGui = game:GetService("StarterGui")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local isBlocking = false
local blockDirection = 8 -- Default block direction (can be changed)

-- Create ScreenGui and UI elements for notification
local screenGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))

-- Create the black box
local blackBox = Instance.new("Frame", screenGui)
blackBox.Size = UDim2.new(0.25, 0, 0.1, 0)
blackBox.Position = UDim2.new(0, 0, 0.9, 0)
blackBox.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
blackBox.BackgroundTransparency = 0.5

-- Create the green loading bar
local loadingBar = Instance.new("Frame", blackBox)
loadingBar.Size = UDim2.new(1, 0, 0.2, 0)
loadingBar.Position = UDim2.new(0, 0, -0.2, 0)
loadingBar.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
loadingBar.BackgroundTransparency = 0.3

-- Create the text label
local messageBox = Instance.new("TextLabel", blackBox)
messageBox.Size = UDim2.new(1, 0, 1, 0)
messageBox.Position = UDim2.new(0, 0, 0, 0)
messageBox.BackgroundTransparency = 1
messageBox.TextColor3 = Color3.fromRGB(255, 255, 255)
messageBox.TextScaled = true
messageBox.Text = "Press 'Q' to activate auto block"

-- Function to start blocking
local function startBlocking()
    if not isBlocking then
        isBlocking = true
        ReplicatedStorage.LightsaberRemotes.Block:FireServer()
        print("Blocking started")
    end
end

-- Function to update block direction
local function updateBlockDirection(direction)
    ReplicatedStorage.LightsaberRemotes.UpdateBlockDirection:FireServer(direction)
end

-- Function to stop blocking
local function stopBlocking()
    if isBlocking then
        isBlocking = false
        ReplicatedStorage.LightsaberRemotes.Unblock:FireServer()
        print("Blocking stopped")
    end
end

-- Function to determine hit direction based on the position of the attacker
local function getHitDirection(attackerPosition)
    local characterPosition = character.PrimaryPart.Position
    local direction = (attackerPosition - characterPosition).unit
    local angle = math.deg(math.atan2(direction.Z, direction.X))
    if angle < 0 then angle = angle + 360 end

    if angle >= 0 and angle < 45 then
        return 1 -- Forward
    elseif angle >= 45 and angle < 135 then
        return 2 -- Right
    elseif angle >= 135 and angle < 225 then
        return 3 -- Backward
    elseif angle >= 225 and angle < 315 then
        return 4 -- Left
    else
        return 1 -- Forward (default wrap-around)
    end
end

-- Simulating hit detection (replace this with actual game logic)
local function onIncomingHit(attackerPosition)
    blockDirection = getHitDirection(attackerPosition)
    updateBlockDirection(blockDirection)
    startBlocking()
end

-- Example incoming hit simulation (replace with actual hit detection)
RunService.Heartbeat:Connect(function()
    local incomingHitDetected = false
    local attackerPosition = Vector3.new(0, 0, 0)

    if math.random() < 0.1 then
        incomingHitDetected = true
        attackerPosition = character.PrimaryPart.Position + Vector3.new(math.random(-10, 10), 0, math.random(-10, 10))
    end

    if incomingHitDetected then
        onIncomingHit(attackerPosition)
    elseif isBlocking then
        stopBlocking()
    end
end)

-- Key binding for manual blocking toggle
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
    if not gameProcessedEvent and input.KeyCode == Enum.KeyCode.Q then
        if isBlocking then
            stopBlocking()
        else
            startBlocking()
        end
    end
end)