-- Zo Samurai Improved Auto Parry Script -- Detects incoming attacks by checking for fast-moving weapon parts near the player. local Players = game:GetService("Players") local RunService = game:GetService("RunService") local VirtualInputManager = game:GetService("VirtualInputManager") local LocalPlayer = Players.LocalPlayer -- Configuration local parryCooldown = 0.15 -- Cooldown in seconds. Lower is faster but riskier. local detectionRange = 25 -- Max range to detect an incoming attack part. local attackVelocityThreshold = 25 -- How fast a part must be moving to be considered an attack. -- State variables local Character local HumanoidRootPart local lastParryTime = 0 -- Function to initialize character and its parts local function initializeCharacter() Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait() HumanoidRootPart = Character:WaitForChild("HumanoidRootPart") end -- Handle character respawns LocalPlayer.CharacterAdded:Connect(function(newChar) Character = newChar HumanoidRootPart = newChar:WaitForChild("HumanoidRootPart") end) -- Main detection loop RunService.Heartbeat:Connect(function() if not Character or not HumanoidRootPart or not Character.Parent then initializeCharacter() return end -- Check cooldown before doing anything if (tick() - lastParryTime) < parryCooldown then return end local myPosition = HumanoidRootPart.Position local shouldParry = false -- Iterate through all players to find potential attackers for _, player in ipairs(Players:GetPlayers()) do if player ~= LocalPlayer and player.Character and player.Character.Parent then local targetCharacter = player.Character -- Check for fast-moving parts in the target's character and tools for _, part in ipairs(targetCharacter:GetDescendants()) do if part:IsA("Part") or part:IsA("MeshPart") then -- Check if the part is close enough and moving fast enough if (myPosition - part.Position).Magnitude <= detectionRange then local partVelocity = part.Velocity.Magnitude if partVelocity > attackVelocityThreshold then -- Optional: Check if the part is moving roughly towards the player local directionToPlayer = (myPosition - part.Position).Unit local movementDirection = part.Velocity.Unit if (directionToPlayer:Dot(movementDirection) > -0.2) then shouldParry = true break -- Found an attack, no need to check other parts for this player end end end end end end if shouldParry then break -- Found an attacker, no need to check other players end end if shouldParry then -- Simulate a right-click (M2) to parry VirtualInputManager:SendMouseButtonEvent(0, 0, 1, true, game, 1) -- Update the last parry time immediately lastParryTime = tick() -- Release the mouse button after a very short duration task.spawn(function() task.wait(0.1) -- Hold duration VirtualInputManager:SendMouseButtonEvent(0, 0, 1, false, game, 1) end) end end) print("Improved Zo Samurai Auto Parry loaded.")