Pastebin
Paste #49722: 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 UserInputService = game:GetService("UserInputService")
local LocalPlayer = Players.LocalPlayer
local Character
local HumanoidRootPart
-- Cooldown to prevent spamming the parry
local parryCooldown = 0 -- in seconds
local lastParryTime = 0
-- Parry enabled state (toggleable with Z key)
local parryEnabled = true
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)
-- Listen for Z key press to toggle parry state
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if not gameProcessed and input.KeyCode == Enum.KeyCode.Z then
parryEnabled = not parryEnabled -- Toggle parryEnabled
print("Parry enabled: " .. tostring(parryEnabled))
end
end)
RunService.Heartbeat:Connect(function()
if not Character or not Character.Parent then
initializeCharacter()
return
end
-- If parry is disabled, skip the entire process
if not parryEnabled then
return
end
-- Check cooldown before doing anything
if (tick() - lastParryTime) < parryCooldown then
return
end
local shouldParry = false
local myPos = HumanoidRootPart.Position
local parryDistance = 13.5 -- Distance to check for enemies
for _, player in ipairs(Players:GetPlayers()) do
if player ~= LocalPlayer and player.Character 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 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.5) -- Very short hold duration
VirtualInputManager:SendMouseButtonEvent(0, 0, 1, false, game, 1)
-- Update the last parry time
lastParryTime = tick()
end
end)
print("EternalWare loaded.")
New Paste
Go to most recent paste.