Pastebin
Paste #49694: 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
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)
RunService.RenderStepped:Connect(function()
if not Character or not Character.Parent then
initializeCharacter()
return
end
local shouldParry = false
local myPos = HumanoidRootPart.Position
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 <= 12.8 then
for , item in ipairs(targetChar:GetChildren()) do
if item:IsA("Tool") and item:GetAttribute("Parry") then
shouldParry = true
break
end
end
if shouldParry then break end
end
end
end
if shouldParry then
VirtualInputManager:SendMouseButtonEvent(0, 0, 1, true, game, 1)
task.wait(0.5)
VirtualInputManager:SendMouseButtonEvent(0, 0, 1, false, game, 1)
end
end)
New Paste
Go to most recent paste.