-- Configuration getgenv().AutoParryEnabled = true -- Toggle variable getgenv().DEBUG_ENABLED = true -- For debug prints getgenv().DETECTION_DISTANCE = 8 -- How close the attacker needs to be getgenv().ANIMATION_PERCENTAGE = 30 -- When to block (percentage through animation) -- Load animations local combatAnims = {} local nonolist = {"Sprint","Idle","Block","Grip","Parry","Feint","Walk","Dash",} local function checkNoList(str) for i,v in pairs(nonolist) do if not string.find(str,"Attack") and string.find(str,v) then return false end end return true end for i,v in pairs(game:GetService("ReplicatedStorage").ReplicatedModules.ModuleListFei.EffectModuleMain.ClientAnimations.Combat:GetDescendants()) do if v.ClassName == "Animation" and checkNoList(v.Name) then local info = { Name = v.Name, AnimationId = v.AnimationId, Parent = v.Parent.Name } table.insert(combatAnims,info) end end -- Main variables local lp = game.Players.LocalPlayer local character = lp.Character or lp.CharacterAdded:Wait() local connections = {} local allAnims = {} -- Debug print function local function debugPrint(...) if getgenv().DEBUG_ENABLED then print(...) end end -- Clean up function local function cleanupConnections() debugPrint("Cleaning up connections...") for i, connection in pairs(connections) do if typeof(connection) == "RBXScriptConnection" then connection:Disconnect() end end table.clear(connections) table.clear(allAnims) debugPrint("Cleanup complete") end -- Setup animation tracking for a player local function setupPlayerAnimations(player) if not player or player.Name == lp.Name then return end local humanoid = player:FindFirstChild("Humanoid") local animator = humanoid and humanoid:FindFirstChild("Animator") if not animator then return end local connection = humanoid.AnimationPlayed:Connect(function(animationTrack) if not getgenv().AutoParryEnabled then return end local info = { anim = animationTrack, plr = player } table.insert(allAnims, info) task.spawn(function() local endedConnection = animationTrack.Ended:Connect(function() local pos = table.find(allAnims, info) if pos then table.remove(allAnims, pos) end end) table.insert(connections, endedConnection) end) end) table.insert(connections, connection) end -- Setup initial players for _, player in pairs(game.Workspace.Entities:GetChildren()) do setupPlayerAnimations(player) end local con = game.Workspace.Entities.ChildAdded:Connect(function (child) wait(1) setupPlayerAnimations(child) end) table.insert(connections,con) -- Main loop local blocking = false task.spawn(function() while true do if not getgenv().AutoParryEnabled then cleanupConnections() break end task.wait() for _, v in pairs(allAnims) do if not v.plr or not getgenv().AutoParryEnabled then continue end local victimChar = v.plr if victimChar and victimChar:FindFirstChild("HumanoidRootPart") and character and character:FindFirstChild("HumanoidRootPart") then local distance = (character.HumanoidRootPart.Position - victimChar.HumanoidRootPart.Position).Magnitude if distance < getgenv().DETECTION_DISTANCE then for _, animData in pairs(combatAnims) do local id = v.anim.Animation.AnimationId if animData.AnimationId == id then local percentage = (v.anim.TimePosition / v.anim.Length) * 100 if percentage > getgenv().ANIMATION_PERCENTAGE and percentage < getgenv().ANIMATION_PERCENTAGE + 10 and not blocking then debugPrint("Attempting to block attack from:", v.plr.Name) debugPrint("Animation id:",id) task.spawn(function() blocking = true -- Block local args = {[1] = {[1] = {["Module"] = "Block",["Bool"] = true},[2] = "\5"}} game:GetService("ReplicatedStorage"):WaitForChild("Bridgenet2Main"):WaitForChild("dataRemoteEvent"):FireServer(unpack(args)) task.wait(0.1) -- Unblock local args = {[1] = {[1] = {["Module"] = "Block",["Bool"] = false},[2] = "\5"}} game:GetService("ReplicatedStorage"):WaitForChild("Bridgenet2Main"):WaitForChild("dataRemoteEvent"):FireServer(unpack(args)) task.wait(0.5) blocking = false end) end end end end end end end end) -- Character respawn handling lp.CharacterAdded:Connect(function(newCharacter) if not getgenv().AutoParryEnabled then return end character = newCharacter end)