Auto parry
Key RequiredUniversal

Auto parry

Universal ScriptJustShareJustShare 7K views 397 executesUpdated Mar 3, 2025
2.5/ 5(2 votes)
1150% Positive
Lua Script•182 lines (6673 chars)
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local VirtualInputManager = game:GetService("VirtualInputManager")

local Player = Players.LocalPlayer
local connection
local previousVelocity = nil
local previousPlayerPosition = nil
local hitboxLine = nil

local function GetBallFromFolder(folder)
    for _, ball in ipairs(folder:GetChildren()) do
        if ball:GetAttribute("realBall") then
            if ball:GetAttribute("parried") == nil then
                ball:SetAttribute("parried", false)
            end
            return ball
        end
    end
    return nil
end

local function ResetConnection()
    if connection then
        connection:Disconnect()
        connection = nil
    end
end

workspace.Balls.ChildAdded:Connect(function(child)
    if Player.Character and Player.Character.Parent and Player.Character.Parent.Name == "Alive" then
        local ball = GetBallFromFolder(workspace.Balls)
        if not ball then return end
        ResetConnection()
        connection = ball:GetAttributeChangedSignal("target"):Connect(function()
            ball:SetAttribute("parried", false)
        end)
    end
end)

workspace.TrainingBalls.ChildAdded:Connect(function(child)
    if Player.Character and Player.Character.Parent and Player.Character.Parent.Name ~= "Alive" then
        local ball = GetBallFromFolder(workspace.TrainingBalls)
        if not ball then return end
        ResetConnection()
        connection = ball:GetAttributeChangedSignal("target"):Connect(function()
            ball:SetAttribute("parried", false)
        end)
    end
end)

local function UpdateHitboxLine(startPos, endPos)
    local distance = (startPos - endPos).Magnitude
    if not hitboxLine then
        hitboxLine = Instance.new("Part")
        hitboxLine.Anchored = true
        hitboxLine.CanCollide = false
        hitboxLine.Color = Color3.new(1, 0, 0)
        hitboxLine.Material = Enum.Material.Neon
        hitboxLine.Transparency = 0.3
        hitboxLine.Parent = workspace
    end
    hitboxLine.Size = Vector3.new(0.2, 0.2, distance)
    hitboxLine.CFrame = CFrame.new(startPos, endPos) * CFrame.new(0, 0, -distance / 2)
end

RunService.PreSimulation:Connect(function()
    local character = Player.Character
    if not character then return end
    local hrp = character:FindFirstChild("HumanoidRootPart")
    if not hrp then return end
    local ballFolder = (character.Parent and character.Parent.Name == "Alive") and workspace.Balls or workspace.TrainingBalls
    local ball = GetBallFromFolder(ballFolder)
    if not ball then
        if hitboxLine then
            hitboxLine:Destroy()
            hitboxLine = nil
        end
        return
    end

    UpdateHitboxLine(hrp.Position, ball.Position)
    
    local currentVelocity = ball.zoomies.VectorVelocity
    local speed = currentVelocity.Magnitude
    local distance = (hrp.Position - ball.Position).Magnitude
    local curvature = 0
    if previousVelocity and speed > 0 and previousVelocity.Magnitude > 0 then
        local dot = math.clamp(previousVelocity.Unit:Dot(currentVelocity.Unit), -1, 1)
        curvature = math.acos(dot)
    end
    previousVelocity = currentVelocity

    local reactionTimeThreshold = (ballFolder == workspace.TrainingBalls) and 0.7 or 0.55
    if curvature > math.rad(10) then
        reactionTimeThreshold = reactionTimeThreshold + 0.1
    end

    local effectiveThreshold = reactionTimeThreshold
    if ballFolder == workspace.TrainingBalls then
        if speed < 10 then
            local multiplier = math.clamp(10 / speed, 1, 3)
            effectiveThreshold = reactionTimeThreshold * multiplier
        elseif speed >= 10 and speed < 70 then
            effectiveThreshold = reactionTimeThreshold * (speed / 70) * 0.8
        end
    else
        if speed >= 20 and speed < 70 then
            effectiveThreshold = reactionTimeThreshold * (speed / 70)
        end
    end
    if speed > 100 then
        effectiveThreshold = effectiveThreshold + ((speed - 100) / 150)
    end

    local otherPlayerNearby = false
    for _, other in ipairs(Players:GetPlayers()) do
        if other ~= Player and other.Character and other.Character:FindFirstChild("HumanoidRootPart") then
            local otherHrp = other.Character.HumanoidRootPart
            if (hrp.Position - otherHrp.Position).Magnitude < 20 then
                otherPlayerNearby = true
                break
            end
        end
    end
    if otherPlayerNearby then
        effectiveThreshold = effectiveThreshold + 0.2
    end

    local humanoid = character:FindFirstChild("Humanoid")
    local direction = (ball.Position - hrp.Position).Unit
    local ballApproachSpeed = currentVelocity:Dot(direction)
    local playerApproachSpeed = hrp.Velocity:Dot(direction)
    local relativeSpeed = ballApproachSpeed - playerApproachSpeed
    if relativeSpeed <= 0 then
        relativeSpeed = currentVelocity.Magnitude
    end
    local predictedTime = distance / relativeSpeed

    local TELEPORT_THRESHOLD = 50
    local TELEPORT_DISTANCE_THRESHOLD = 15
    if previousPlayerPosition then
        local displacement = (hrp.Position - previousPlayerPosition).Magnitude
        if displacement > TELEPORT_THRESHOLD and distance < TELEPORT_DISTANCE_THRESHOLD then
            if ball:GetAttribute("target") == Player.Name and not ball:GetAttribute("parried") then
                VirtualInputManager:SendMouseButtonEvent(0, 0, 0, true, game, 0)
                ball:SetAttribute("parried", true)
            end
        end
    end

    if ball:GetAttribute("target") == Player.Name and not ball:GetAttribute("parried") and speed > 0 and distance <= 50 then
        if predictedTime <= effectiveThreshold then
            VirtualInputManager:SendMouseButtonEvent(0, 0, 0, true, game, 0)
            ball:SetAttribute("parried", true)
        end
    end

    hrp.CFrame = CFrame.new(hrp.Position, ball.Position)
    previousPlayerPosition = hrp.Position

    if character.Parent and character.Parent.Name == "Alive" and humanoid then
        local bv = hrp:FindFirstChild("AutoMoveVelocity")
        if not bv then
            bv = Instance.new("BodyVelocity")
            bv.Name = "AutoMoveVelocity"
            bv.MaxForce = Vector3.new(1e5, 0, 1e5)
            bv.P = 1000
            bv.Parent = hrp
        end
        if distance > 15 then
            bv.Velocity = (ball.Position - hrp.Position).Unit * (humanoid.WalkSpeed or 16)
        else
            bv.Velocity = Vector3.new(0, 0, 0)
        end
    else
        local bv = hrp:FindFirstChild("AutoMoveVelocity")
        if bv then
            bv:Destroy()
        end
    end
end)

Features & Information

Simple logic for auto Parry and following balls
#Open Source#Free#Blade Ball

Community Comments (4)

skuidigaming1skuidigaming1Mar 3, 2025(edited)

bro its just following the ball and do nothing but die

JustShareJustShareMar 3, 2025(edited)

@skuidigaming1 Are you sure about that? You can adjusment Threshold for parry

JustShareJustShareMar 3, 2025(edited)

Like 0,55 for Threshold

JustShareJustShareMar 3, 2025(edited)

@skuidigaming1 I have tried it and it works normally, the only drawback is during training, you can adjust that

More Scripts for Universal Scripts