local Players = game:GetService("Players") local RunService = game:GetService("RunService") local VirtualInputManager = game:GetService("VirtualInputManager") local UserInputService = game:GetService("UserInputService") local LocalPlayer = Players.LocalPlayer local Character local HumanoidRootPart -- Cooldown to prevent spamming the parry local parryCooldown = 0.5 -- Slightly increased cooldown to give better parry time local lastParryTime = 0 -- Feint detection variables local feintWindowTime = 0.3 -- Time window to detect feints in seconds (adjustable) local activeAttacks = {} -- Store active attacks and their start times local function initializeCharacter() Character = LocalPlayer.Character if not Character then Character = LocalPlayer.CharacterAdded:Wait() end HumanoidRootPart = Character:WaitForChild("HumanoidRootPart") end initializeCharacter() LocalPlayer.CharacterAdded:Connect(function(newChar) Character = newChar HumanoidRootPart = newChar:WaitForChild("HumanoidRootPart") end) -- Helper function to track a swing (e.g., start time, tool being used) local function startAttack(player, tool) local startTime = tick() -- Record the time the swing started activeAttacks[player] = { tool = tool, startTime = startTime } print(player.Name .. " started an attack with " .. tool.Name .. " at " .. startTime) -- Debugging end -- Helper function to check if the attack was a feint (if the swing is canceled) local function checkFeint(player) local attackData = activeAttacks[player] if not attackData then return false end local tool = attackData.tool local startTime = attackData.startTime -- Check if the swing was canceled within the feint window time if tick() - startTime < feintWindowTime and not tool.Parent then -- The tool was removed (indicating cancelation or switch), mark as feint activeAttacks[player] = nil print(player.Name .. " performed a feint!") -- Debugging return true end return false end RunService.Heartbeat:Connect(function() if not Character or not Character.Parent then initializeCharacter() return end -- Check cooldown before doing anything if (tick() - lastParryTime) < parryCooldown then return end local shouldParry = false local myPos = HumanoidRootPart.Position local parryDistance = 13.5 -- Distance to check for enemies for _, player in ipairs(Players:GetPlayers()) do if player ~= LocalPlayer and player.Character then local targetChar = player.Character local targetHRP = targetChar:FindFirstChild("HumanoidRootPart") if targetHRP and (myPos - targetHRP.Position).Magnitude <= parryDistance then -- Check if the player is holding a tool that can be parried for _, item in ipairs(targetChar:GetChildren()) do if item:IsA("Tool") and item:GetAttribute("Parry") then -- Check for feint (attack was canceled before reaching) if checkFeint(player) then shouldParry = true break end end end end end if shouldParry then break end end if shouldParry then -- Simulate a right-click (commonly used for block/parry) VirtualInputManager:SendMouseButtonEvent(0, 0, 1, true, game, 1) task.wait(0.5) -- Very short hold duration VirtualInputManager:SendMouseButtonEvent(0, 0, 1, false, game, 1) -- Update the last parry time lastParryTime = tick() print("Parry executed!") -- Debugging end end) -- Listen for when players start swinging their tools (we need to track this for feints) for _, player in ipairs(Players:GetPlayers()) do if player ~= LocalPlayer then player.CharacterAdded:Connect(function(character) character:WaitForChild("Humanoid") -- Detect when the player uses a tool (e.g., swinging a weapon) for _, item in ipairs(character:GetChildren()) do if item:IsA("Tool") and item:GetAttribute("Parry") then item.Activated:Connect(function() startAttack(player, item) end) end end end) end end print("EternalWare loaded with Feint Detection.")