-- Place this script in a LocalScript or a Script within the player's character or combat system local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local blockAnimation = Instance.new("Animation") blockAnimation.AnimationId = "rbxassetid://BLOCK_ANIMATION_ID" -- Replace with the correct animation ID local parryCooldown = 0.5 -- Time between each parry action local parryActive = true -- We start with the parry being active (can change to false for cooldown) -- Parry detection function (this is triggered when an attack is received) local function onAttackReceived(otherPart) if parryActive then -- Check if the part that touched belongs to an enemy character (has a humanoid) if otherPart and otherPart.Parent and otherPart.Parent:FindFirstChild("Humanoid") then -- Simulate a successful parry (depending on your attack system) -- Play the block animation on successful parry humanoid:LoadAnimation(blockAnimation):Play() -- Set a cooldown to avoid spamming parries parryActive = false -- Add a delay to reset the parry cooldown wait(parryCooldown) parryActive = true end end end -- Function to start the parry action (triggered by player input) local function startParry() if not parryActive then return end -- Set parryActive to false temporarily to avoid spamming parryActive = false -- Wait for the parry window (e.g., until the next attack hits) wait(0.1) -- Adjust the timing window for the parry to work -- After the window, reset the parry state parryActive = true end -- Trigger startParry when the M2 (right mouse button) is pressed game:GetService("UserInputService").InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.UserInputType == Enum.UserInputType.MouseButton2 then -- Trigger the parry on M2 (right mouse button) press startParry() end end) -- Connect attack received (you can further adjust to listen for the exact attack) character:WaitForChild("HumanoidRootPart").Touched:Connect(onAttackReceived)