Pastebin
Paste #49698: No description
< previous paste - next paste>
Pasted by Anonymous Coward
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local VirtualInputManager = game:GetService("VirtualInputManager")
local Workspace = game:GetService("Workspace")
local LocalPlayer = Players.LocalPlayer
local Character
local HumanoidRootPart
-- Cooldown to prevent spamming the parry
local parryCooldown = 0.4 -- in seconds
local lastParryTime = 0
-- The name of the part that signifies a real attack. THIS IS CRITICAL.
-- You may need to inspect the Workspace during an attack to find the exact name.
-- Common names are "Slash", "Hitbox", "Attack", "SwordSlash", etc.
local ATTACK_PART_NAME = "Slash"
-- The maximum distance an attack part can be from you to trigger a parry.
local parryDistance = 20
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)
-- This is the core of the anti-feint logic.
-- It only fires when an attack part is actually created in the world.
Workspace.DescendantAdded:Connect(function(attackPart)
-- Check cooldown first
if (tick() - lastParryTime) < parryCooldown then
return
end
-- Check if the created part is the one we're looking for
if attackPart.Name == ATTACK_PART_NAME then
-- Wait a frame to ensure all properties are set
task.wait()
-- Check if the part has a valid CFrame (position)
if not attackPart.CFrame then
return
end
-- Check if the attack is close enough to matter
local myPos = HumanoidRootPart.Position
local attackPos = attackPart.Position
if (myPos - attackPos).Magnitude <= parryDistance then
-- This is a real attack! Parry now.
VirtualInputManager:SendMouseButtonEvent(0, 0, 1, true, game, 1)
task.wait(0.1) -- Hold duration, can be very short
VirtualInputManager:SendMouseButtonEvent(0, 0, 1, false, game, 1)
-- Update the last parry time
lastParryTime = tick()
end
end
end)
print("EternalWare loaded.")
New Paste
Go to most recent paste.