--// CONFIG
local ragelimit = 15
local AimParry = true
local ParryTp = false
--//
local players = game:GetService("Players")
local client = players.LocalPlayer
local camera = workspace.CurrentCamera
local input = game:GetService("UserInputService")
local runService = game:GetService("RunService")
local aliveCache = {}
local function iskeydown(enum)
if not input or not input.IsKeyDown then return false end
return input:IsKeyDown(enum)
end
local function keyclick(enum)
keypress(enum)
keyrelease(enum)
end
local function lookAtCharacter(character)
local char = client.Character
if not char then return end
local hrp = char:FindFirstChild("HumanoidRootPart")
local humanoid = char:FindFirstChildOfClass("Humanoid")
if not hrp or not humanoid or not character or not character:FindFirstChild("HumanoidRootPart") then return end
local targetPos = character.HumanoidRootPart.Position
local oldAuto = humanoid.AutoRotate
humanoid.AutoRotate = true
hrp.CFrame = CFrame.new(hrp.Position, Vector3.new(targetPos.X, hrp.Position.Y, targetPos.Z))
humanoid.AutoRotate = oldAuto
end
local function instantLookAtCamera(character)
if not character or not character:FindFirstChild("HumanoidRootPart") then return end
local target = character.HumanoidRootPart.Position
camera.CFrame = CFrame.lookAt(camera.CFrame.Position, target)
end
local function isFacingYou(chr, sensitivity)
if not chr or not chr:FindFirstChild("HumanoidRootPart") or not client.Character or not client.Character:FindFirstChild("HumanoidRootPart") then return false end
local dir = chr.HumanoidRootPart.CFrame.LookVector
local toYou = (client.Character.HumanoidRootPart.Position - chr.HumanoidRootPart.Position)
if toYou.Magnitude == 0 then return false end
toYou = toYou.Unit
return dir:Dot(toYou) >= (sensitivity or 0.25)
end
local function refreshAliveCache()
for _, p in ipairs(players:GetPlayers()) do
if p ~= client and p.Character then
local hum = p.Character:FindFirstChildOfClass("Humanoid")
if hum and hum.Health > 0 then
aliveCache[p] = true
else
aliveCache[p] = nil
end
else
aliveCache[p] = nil
end
end
end
local function getNearestAlivePlayer()
local char = client.Character
if not char or not char:FindFirstChild("HumanoidRootPart") then return nil, math.huge end
local myPos = char.HumanoidRootPart.Position
local nearest, dist = nil, math.huge
for plr in pairs(aliveCache) do
if plr.Character and plr.Character:FindFirstChild("HumanoidRootPart") then
local hrp = plr.Character.HumanoidRootPart
local d = (hrp.Position - myPos).Magnitude
if d < dist and d <= ragelimit then
nearest = plr
dist = d
end
end
end
return nearest, dist
end
local function monitorHealth(plr)
if plr == client then return end
plr.CharacterAdded:Connect(function(chr)
local hum = chr:WaitForChild("Humanoid", 5)
if hum then
hum.HealthChanged:Connect(function(h)
if h > 0 then
aliveCache[plr] = true
else
aliveCache[plr] = nil
end
end)
end
end)
end
for _, p in ipairs(players:GetPlayers()) do
monitorHealth(p)
end
players.PlayerAdded:Connect(monitorHealth)
players.PlayerRemoving:Connect(function(p)
aliveCache[p] = nil
end)
local successAnimIds = {
["rbxassetid://76407687840829"] = true,
["rbxassetid://126121029068038"] = true
}
local function checkParrySuccessByAnimation(chr, timeout)
local hum = chr and chr:FindFirstChildOfClass("Humanoid")
if not hum then return false end
local start = tick()
while tick() - start < (timeout or 0.4) do
for _, t in ipairs(hum:GetPlayingAnimationTracks()) do
if t.Animation and successAnimIds[t.Animation.AnimationId] then
return true
end
end
runService.Stepped:Wait()
end
return false
end
local cooldownReleaseTime = 0
local pendingHits = {}
local function autoParryWhenHit(child, chr)
if not child:IsA("Sound") then return end
table.insert(pendingHits, {child = child, chr = chr})
end
runService.Stepped:Connect(function()
if tick() < cooldownReleaseTime then return end
for i, data in ipairs(pendingHits) do
local child = data.child
local chr = data.chr
if child and chr and chr:FindFirstChild("HumanoidRootPart") and client.Character and client.Character:FindFirstChildOfClass("Tool") then
local nearest, nearestDist = getNearestAlivePlayer()
if nearest and nearest.Character == chr and nearestDist <= ragelimit and isFacingYou(chr, 0.25) then
if AimParry then
instantLookAtCamera(chr)
end
lookAtCharacter(chr)
if ParryTp then
local hrp = client.Character and client.Character:FindFirstChild("HumanoidRootPart")
local chrhrp = chr:FindFirstChild("HumanoidRootPart")
if hrp and chrhrp then
local dir = (chrhrp.Position - hrp.Position).Unit
hrp.CFrame = CFrame.new(chrhrp.Position - dir * 2, chrhrp.Position)
end
end
keyclick(Enum.KeyCode.F)
cooldownReleaseTime = tick() + 3.5
local success = checkParrySuccessByAnimation(chr, 0.4)
if success then cooldownReleaseTime = 0 end
end
end
pendingHits[i] = nil
end
end)
local function Update(plr)
if plr == client then return end
local function onRespawn(chr)
repeat runService.Stepped:Wait() until chr:FindFirstChildOfClass("Tool") and chr:FindFirstChildOfClass("Tool"):FindFirstChild("Hitboxes")
local tool = chr:FindFirstChildOfClass("Tool")
local hitboxes = tool and tool:FindFirstChild("Hitboxes")
if not hitboxes then return end
local hitbox = hitboxes:FindFirstChild("Hitbox") or hitboxes:FindFirstChild("Weapon1Hitbox") or hitboxes:FindFirstChild("Weapon2Hitbox")
if hitbox then
hitbox.ChildAdded:Connect(function(child)
autoParryWhenHit(child, chr)
end)
end
end
if plr.Character then task.spawn(onRespawn, plr.Character) end
plr.CharacterAdded:Connect(function(chr)
task.spawn(onRespawn, chr)
end)
end
for _, v in ipairs(players:GetPlayers()) do
task.spawn(Update, v)
end
players.PlayerAdded:Connect(function(plr)
task.spawn(Update, plr)
end)
task.spawn(function()
while task.wait(0.2) do
refreshAliveCache()
end
end)
Comments
yo it doesn't works for me
yo the script doesn't works for me ]
I will try create another code better that and faster