Pastebin

Paste #49704: No description

< previous paste - next paste>

Pasted by Anonymous Coward

Download View as text

-- Zo Samurai Combined No Delay & Auto Parry Script
-- Merges instant attacks with proximity-based auto-parry.

-- SERVICES
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local VirtualInputManager = game:GetService("VirtualInputManager")

-- PLAYER AND CHARACTER
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local HumanoidRootPart = character:WaitForChild("HumanoidRootPart")

-- REMOTE EVENT (You may need to update this name)
local swordRemote = ReplicatedStorage:WaitForChild("SwordEvent")

-- AUTO PARRY CONFIGURATION
local parryCooldown = 0.4 -- in seconds
local lastParryTime = 0
local parryDistance = 13.8 -- Distance to check for enemies

-- NO DELAY CONFIGURATION
local attackDelay = 0.01 -- Very low value for instant attacks

-- AUTO PARRY LOGIC
local function handleAutoParry()
    -- Check cooldown before doing anything
    if (tick() - lastParryTime) < parryCooldown then
        return
    end

    local shouldParry = false
    local myPos = HumanoidRootPart.Position

    for _, targetPlayer in ipairs(Players:GetPlayers()) do
        if targetPlayer ~= player and targetPlayer.Character then
            local targetChar = targetPlayer.Character
            local targetHRP = targetChar:FindFirstChild("HumanoidRootPart")
            
            if targetHRP and (myPos - targetHRP.Position).Magnitude <= parryDistance then
                -- Check if the target is holding a tool that can be parried
                for _, item in ipairs(targetChar:GetChildren()) do
                    if item:IsA("Tool") and item:GetAttribute("Parry") then
                        shouldParry = true
                        break
                    end
                end
            end
        end
        if shouldParry then
            break
        end
    end

    if shouldParry then
        -- Simulate a right-click (commonly used for block/parry)
        VirtualInputManager:SendMouseButtonEvent(0, 0, 1, true, game, 1)
        task.wait(0.05) -- Very short hold duration
        VirtualInputManager:SendMouseButtonEvent(0, 0, 1, false, game, 1)
        
        -- Update the last parry time
        lastParryTime = tick()
    end
end

-- NO DELAY ATTACK LOGIC
local function spamAttacks()
    while task.wait(attackDelay) do
        -- Fire the sword attack remote event as fast as possible
        if swordRemote and humanoid.Health > 0 then
            swordRemote:FireServer()
        end
    end
end

-- INITIALIZE SCRIPT
print("EternalWare loaded.")

-- Handle character respawn/reload
player.CharacterAdded:Connect(function(newChar)
    character = newChar
    humanoid = newChar:WaitForChild("Humanoid")
    HumanoidRootPart = newChar:WaitForChild("HumanoidRootPart")
end)

-- Start the separate loops
spawn(spamAttacks)

-- Connect the parry logic to the game's heartbeat for frequent checks
RunService.Heartbeat:Connect(function()
    if not character or not character.Parent then
        return
    end
    handleAutoParry()
end)

New Paste


Do not write anything in this field if you're a human.

Go to most recent paste.