Further enhance this script, and add more ANTI slap features:

```
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local VirtualInputManager = game:GetService("VirtualInputManager")

local LightsaberRemotes = ReplicatedStorage:WaitForChild("LightsaberRemotes")
local BlockRemote = LightsaberRemotes:WaitForChild("Block")
local UnblockRemote = LightsaberRemotes:WaitForChild("Unblock")

-- Settings
local blockDistance = 20 -- Maximum distance to initiate a block
local autoCounterEnabled = true -- Enable automatic counter-slapping
local autoSlapDistance = 10 -- Distance to perform automatic slap counter
local reactionTimeThreshold = 0.15 -- Threshold for reaction time in seconds
local blockDuration = 0.3 -- Duration to hold the block

-- Slap Animations
local slapAnimations = {
    ["Slap"] = 12625891544,
    ["SlappedLegs"] = 12671715182,
    ["SlappedArms"] = 12625896358
}

local lastBlockTime = 0
local isBlocking = false

local function getClosestPlayer()
    local closestPlayer = nil
    local shortestDistance = math.huge
    local localPlayer = Players.LocalPlayer
    local localCharacter = localPlayer.Character

    if localCharacter and localCharacter:FindFirstChild("HumanoidRootPart") then
        local localPosition = localCharacter.HumanoidRootPart.Position

        for _, player in ipairs(Players:GetPlayers()) do
            if player ~= localPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
                local playerPosition = player.Character.HumanoidRootPart.Position
                local distance = (playerPosition - localPosition).Magnitude

                if distance < shortestDistance then
                    closestPlayer = player
                    shortestDistance = distance
                end
            end
        end
    end

    return closestPlayer, shortestDistance
end

local function handleSlapAnimation(opponent, animTrack)
    local localPlayer = Players.LocalPlayer
    local character = localPlayer.Character
    if not character then return end

    local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
    if not humanoidRootPart then return end

    local opponentRootPart = opponent.Character and opponent.Character:FindFirstChild("HumanoidRootPart")
    if not opponentRootPart then return end

    local distance = (humanoidRootPart.Position - opponentRootPart.Position).Magnitude

    if distance <= blockDistance and not isBlocking then
        local currentTime = tick()
        local timeSinceLastBlock = currentTime - lastBlockTime

        if timeSinceLastBlock >= reactionTimeThreshold then
            isBlocking = true
            BlockRemote:FireServer()

            -- Set block duration
            task.delay(blockDuration, function()
                if isBlocking then
                    UnblockRemote:FireServer()
                    isBlocking = false
                end
            end)

            lastBlockTime = currentTime

            -- Automatic counter-slap
            if autoCounterEnabled and distance <= autoSlapDistance then
                task.delay(blockDuration * 0.5, function()
                    VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.E, false, game)
                    task.wait(0.1)
                    VirtualInputManager:SendKeyEvent(false, Enum.KeyCode.E, false, game)
                end)
            end
        end
    end
end

local function onOpponentAnimationPlayed(opponent, animTrack)
    for animName, animId in pairs(slapAnimations) do
        if animTrack.Animation.AnimationId == "rbxassetid://" .. animId then
            handleSlapAnimation(opponent, animTrack)
            break
        end
    end
end

local function onCharacterAdded(character)
    local humanoid = character:WaitForChild("Humanoid")
    local opponent = Players:GetPlayerFromCharacter(character)

    if not opponent or opponent == Players.LocalPlayer then return end

    humanoid.AnimationPlayed:Connect(function(animTrack)
        onOpponentAnimationPlayed(opponent, animTrack)
    end)
end

for _, player in ipairs(Players:GetPlayers()) do
    if player.Character then
        onCharacterAdded(player.Character)
    end
    player.CharacterAdded:Connect(onCharacterAdded)
end

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(onCharacterAdded)
end)

RunService.Heartbeat:Connect(function()
    local closestPlayer, distance = getClosestPlayer()
    if closestPlayer and distance <= blockDistance then
        -- You can add additional logic here if needed
    end
end)