Pastebin
Paste #49699: 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 LocalPlayer = Players.LocalPlayer
local Character
local HumanoidRootPart
-- Cooldown to prevent spamming the parry
local parryCooldown = 0.4 -- in seconds
local lastParryTime = 0
-- Configuration
local parryDistance = 15 -- Distance to check for enemies
local swingVelocityThreshold = 15 -- Minimum velocity of the tool to be considered an attack
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)
-- We'll store the last position of each tool to calculate velocity
local lastToolPositions = {}
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 myPos = HumanoidRootPart.Position
local shouldParry = false
for _, player in ipairs(Players:GetPlayers()) do
if player ~= LocalPlayer and player.Character and player.Character:FindFirstChild("Humanoid") and player.Character.Humanoid.Health > 0 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
local equippedTool = targetChar:FindFirstChildOfClass("Tool")
if equippedTool and equippedTool:FindFirstChild("Handle") then
local handle = equippedTool.Handle
local currentPos = handle.Position
local toolName = equippedTool.Name
-- Get the last position to calculate velocity
local lastPos = lastToolPositions[toolName]
if lastPos then
-- Calculate the velocity of the tool's handle
local deltaTime = RunService.Heartbeat:Wait()
local velocity = (currentPos - lastPos).Magnitude / deltaTime
-- Check if the velocity is high enough to be an attack
-- This is the key anti-feint check. A feint won't generate high velocity.
if velocity > swingVelocityThreshold then
shouldParry = true
end
end
-- Update the last position for the next frame
lastToolPositions[toolName] = currentPos
end
end
end
if shouldParry then
break
end
end
if shouldParry then
-- Simulate a right-click (block/parry)
VirtualInputManager:SendMouseButtonEvent(0, 0, 1, true, game, 1)
task.wait(0.1) -- Very short hold duration
VirtualInputManager:SendMouseButtonEvent(0, 0, 1, false, game, 1)
-- Update the last parry time
lastParryTime = tick()
end
end)
print("EternalWare (Velocity-Check Edition) loaded.")
New Paste
Go to most recent paste.