-- Services
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local plr = Players.LocalPlayer
-- Configuration Settings
local Settings = {
Autoparry = {
Toggle = true,
Range = 25,
Delay = 0.05, -- Reduced base delay for faster reactions
Fov = 180,
Facing = true,
Dodgerange = 3,
Aimhelper = true,
},
ESP = {
Toggle = false,
Config = {}
},
Tpaura = {
Toggle = false,
},
}
-- Ping Adjustment Settings
local PingSettings = {
AdjustmentFactor = 0.001, -- Seconds added per ms ping
MinimumDelay = 0.05, -- Minimum possible delay in seconds
MaximumDelay = 0.3, -- Maximum possible delay in seconds
}
-- Animation Timings
local anims = {
-- Saitama
["rbxassetid://10469493270"] = {0, 0.30},
["rbxassetid://10469630950"] = {0, 0.30},
["rbxassetid://10469639222"] = {0, 0.30},
["rbxassetid://10469643643"] = {0, 0.30},
-- Hunter
["rbxassetid://13532562418"] = {0, 0.30},
["rbxassetid://13532600125"] = {0, 0.30},
["rbxassetid://13532604085"] = {0, 0.30},
["rbxassetid://13294471966"] = {0, 0.30},
-- Cyborg
["rbxassetid://13491635433"] = {0, 0.30},
["rbxassetid://13296577783"] = {0, 0.30},
["rbxassetid://13295919399"] = {0, 0.30},
["rbxassetid://13295936866"] = {0, 0.30},
-- Ninja
["rbxassetid://13370310513"] = {0, 0.30},
["rbxassetid://13390230973"] = {0, 0.30},
["rbxassetid://13378751717"] = {0, 0.30},
["rbxassetid://13378708199"] = {0, 0.30},
abilities = {}
}
-- Dodge Animations Timing
local dodges = {
["rbxassetid://10479335397"] = {0, 0.50},
["rbxassetid://13380255751"] = {0, 0.50},
["rbxassetid://10480796021"] = {0, 0.50},
["rbxassetid://10480793962"] = {0, 0.50}
}
-- Barrage Animations Timing
local barrages = {
["rbxassetid://10466974800"] = {0.20, 1.80},
["rbxassetid://12534735382"] = {0.20, 1.80}
}
-- Abilities Timing
local abilities = {
["rbxassetid://10468665991"] = {0.15, 0.60},
["rbxassetid://13376869471"] = {0.05, 1},
["rbxassetid://13376962659"] = {0, 2},
["rbxassetid://12296882427"] = {0.05, 1}, -- Sonic
["rbxassetid://13309500827"] = {0.05, 1}, -- Sonic
["rbxassetid://13365849295"] = {0, 1}, -- Sonic
["rbxassetid://13377153603"] = {0, 1}, -- Sonic
["rbxassetid://12509505723"] = {0.09, 2}, -- Dash for Cyborg
}
-- Action Durations
local durations = {
anim = 0.3,
dodge = 0.9,
barrage = 0.9,
ability = 0.6,
}
-- Prediction Constants
local VELOCITY_ALPHA = 0.2 -- EMA smoothing factor
local PREDICTION_TIME_BASE = 0.2
local PREDICTION_TIME_ADJUSTMENT_FACTOR = 0.02
local ROTATION_SPEED = 25 -- Adjust as needed
-- Variables for EMA
local velocityEMA = Vector3.new(0, 0, 0)
-- Cooldowns
local isParrying = false
local isBlocking = false
-- Cached Closest Players
local closestplr, anim, plrDirection, unit, value, dodge, ability, barrage
-- Helper Function for Debug Logging (Optional)
local function debugLog(msg)
-- Uncomment the line below to enable debug logging
-- print("[DEBUG]", msg)
end
-- Function to Find Closest Players Within Range
local function closest()
closestplr = {}
if not plr.Character or not plr.Character:FindFirstChild("HumanoidRootPart") then
return closestplr
end
for _, v in ipairs(Players:GetPlayers()) do
if v ~= plr and v.Character and v.Character:FindFirstChild("HumanoidRootPart") then
local dist = (v.Character.HumanoidRootPart.Position - plr.Character.HumanoidRootPart.Position).Magnitude
if dist < Settings.Autoparry.Range then
table.insert(closestplr, v)
end
end
end
return closestplr
end
-- Advanced EMA-Based Position Prediction Function
local function getPredictedPosition(targetCharacter)
local torsoPartName = "HumanoidRootPart"
local humanoidRootPart = plr.Character.HumanoidRootPart
local targetTorso = targetCharacter:FindFirstChild(torsoPartName)
if not targetTorso then
debugLog("Target does not have " .. torsoPartName .. ".")
return nil
end
-- Get current velocity
local currentVelocity = targetTorso.Velocity
-- Update Exponential Moving Average (EMA) for velocity
velocityEMA = (currentVelocity * VELOCITY_ALPHA) + (velocityEMA * (1 - VELOCITY_ALPHA))
-- Calculate dynamic prediction time based on velocity magnitude and distance
local distance = (targetTorso.Position - humanoidRootPart.Position).Magnitude
local velocityMagnitude = velocityEMA.Magnitude
-- Prevent division by zero and unrealistic prediction
velocityMagnitude = velocityMagnitude > 0 and velocityMagnitude or 0.1
-- Optimal prediction time (e.g., time to reach the player)
local predictionTime = PREDICTION_TIME_BASE + (velocityMagnitude * PREDICTION_TIME_ADJUSTMENT_FACTOR) + (distance * PREDICTION_TIME_ADJUSTMENT_FACTOR)
predictionTime = math.clamp(predictionTime, 0.2, 0.8) -- Clamp prediction time between 0.2 and 0.8 seconds
-- Calculate predicted position
local futurePosition = targetTorso.Position + (velocityEMA * predictionTime)
debugLog(string.format("Predicted position: (%.2f, %.2f, %.2f); Prediction Time: %.2f",
futurePosition.X, futurePosition.Y, futurePosition.Z, predictionTime))
return futurePosition
end
-- Function: Instantly Rotate to Face the Predicted Target Position
local function instantRotateToPosition(targetPosition)
if not targetPosition or not plr.Character or not plr.Character:FindFirstChild("HumanoidRootPart") then return end
local humanoidRootPart = plr.Character.HumanoidRootPart
local desiredCFrame = CFrame.new(humanoidRootPart.Position, targetPosition)
humanoidRootPart.CFrame = desiredCFrame
debugLog("Instantly rotated to face predicted position.")
end
-- Function: Smoothly Rotate to Face the Predicted Target Position
local function smoothRotateToPosition(targetPosition, deltaTime)
if not targetPosition or not plr.Character or not plr.Character:FindFirstChild("HumanoidRootPart") then return end
local humanoidRootPart = plr.Character.HumanoidRootPart
local direction = (Vector3.new(targetPosition.X, humanoidRootPart.Position.Y, targetPosition.Z) - humanoidRootPart.Position).Unit
local desiredCFrame = CFrame.new(humanoidRootPart.Position, humanoidRootPart.Position + direction)
-- Smoothly interpolate the CFrame
humanoidRootPart.CFrame = humanoidRootPart.CFrame:Lerp(desiredCFrame, ROTATION_SPEED * deltaTime)
debugLog("Smoothly rotated to face predicted position.")
end
-- Function to Predict Future Position Based on Target's Velocity using EMA
local function predictPosition(enemy, deltaTime)
return getPredictedPosition(enemy.Character)
end
-- Function to Check if Player is Currently Performing an Attack
local function attackchecker()
if not plr.Character or not plr.Character:FindFirstChild("Humanoid") then
return false
end
for _, Anim in ipairs(plr.Character.Humanoid.Animator:GetPlayingAnimationTracks()) do
if anims[Anim.Animation.AnimationId] or dodges[Anim.Animation.AnimationId] or abilities[Anim.Animation.AnimationId] or barrages[Anim.Animation.AnimationId] then
return true
end
end
return false
end
-- Function to Determine if Enemy is Facing the Player
local function isfacing(enemy)
if Settings.Autoparry.Toggle then
if Settings.Autoparry.Facing then
if not plr.Character:FindFirstChild("Head") or not enemy.Character:FindFirstChild("Head") then
return false
end
plrDirection = plr.Character.Head.CFrame.LookVector
unit = (enemy.Character.Head.CFrame.Position - plr.Character.Head.CFrame.Position).Unit
value = math.pow((plrDirection - unit).Magnitude / 2, 2)
return value < Settings.Autoparry.Fov / 360
else
return true
end
end
return false
end
-- Function to Determine if Parry or Block is Allowed
local function allowed(enemy)
if not plr.Character:FindFirstChild("M1ing") and not attackchecker() and isfacing(enemy) then
return true
end
return false
end
-- Function to Retrieve Current Ping in Seconds
local function getPing()
local ping = plr:GetNetworkPing()
-- Assuming GetNetworkPing() returns ping in milliseconds
return ping / 1000
end
-- Function to Compute Adjusted Delay Based on Ping
local function computeAdjustedDelay(baseDelay)
local ping = getPing()
local adjustedDelay = baseDelay + (ping * PingSettings.AdjustmentFactor)
-- Clamp the adjusted delay between minimum and maximum values
adjustedDelay = math.clamp(adjustedDelay, PingSettings.MinimumDelay, PingSettings.MaximumDelay)
return adjustedDelay
end
-- Parry Action Handler with Dynamic Delay
local function def(action)
if isParrying or isBlocking then return end
isParrying = true
local adjustedDelay = computeAdjustedDelay(Settings.Autoparry.Delay)
task.delay(adjustedDelay, function()
print("Parry attempt | Action: " .. action)
plr.Character.Communicate:FireServer({["Goal"] = "KeyPress", ["Key"] = Enum.KeyCode.F})
local actionDuration = durations[action] or 0.3
local adjustedDuration = computeAdjustedDelay(actionDuration)
task.delay(adjustedDuration, function()
plr.Character.Communicate:FireServer({["Goal"] = "KeyRelease", ["Key"] = Enum.KeyCode.F})
isParrying = false
end)
end)
end
-- Block Action Handler with Dynamic Duration
local function block(action, duration)
if isBlocking then return end
isBlocking = true
print("Block attempt | Action: " .. action)
plr.Character.Communicate:FireServer({["Goal"] = "KeyPress", ["Key"] = Enum.KeyCode.B}) -- Assuming 'B' is the block key
local blockDuration = duration or 0.5
local adjustedBlockDuration = computeAdjustedDelay(blockDuration)
task.delay(adjustedBlockDuration, function()
plr.Character.Communicate:FireServer({["Goal"] = "KeyRelease", ["Key"] = Enum.KeyCode.B})
isBlocking = false
end)
end
-- Function to Rotate Player to Face the Predicted Position
local function rotateTowards(enemy, deltaTime)
local predictedPos = predictPosition(enemy, deltaTime)
if Settings.Autoparry.Aimhelper then
-- Choose between instant or smooth rotation based on preference
-- instantRotateToPosition(predictedPos)
smoothRotateToPosition(predictedPos, deltaTime)
end
end
-- Main Parry Function
local function parry(deltaTime)
for _, c in ipairs(closest()) do
if c and c.Character and c.Character:FindFirstChild("Humanoid") and c.Character.Humanoid:FindFirstChild("Animator") then
rotateTowards(c, deltaTime)
for _, v in ipairs(c.Character.Humanoid.Animator:GetPlayingAnimationTracks()) do
anim = anims[v.Animation.AnimationId]
dodge = dodges[v.Animation.AnimationId]
ability = abilities[v.Animation.AnimationId]
barrage = barrages[v.Animation.AnimationId]
if allowed(c.Character) then
if anim and v.TimePosition >= anim[1] and v.TimePosition <= anim[2] then
task.spawn(function()
def("anim")
end)
elseif dodge and v.TimePosition > dodge[1] and v.TimePosition < dodge[2] then
task.spawn(function()
block("dodge", durations["dodge"])
end)
elseif barrage and v.TimePosition > barrage[1] and v.TimePosition < barrage[2] then
task.spawn(function()
def("barrage")
end)
elseif ability and v.TimePosition > ability[1] and v.TimePosition < ability[2] then
task.spawn(function()
def("ability")
end)
end
end
end
end
end
end
-- Connect Parry Function to Heartbeat for Real-Time Execution
RunService.Heartbeat:Connect(function(deltaTime)
if Settings.Autoparry.Toggle then
parry(deltaTime)
end
end)
warn("Enhanced Autoparry and Auto-Block Script Executed with Dynamic Ping Handling")