Quick actions

cmd+k|ctrl+k

Navigation

Languages

open src autoparry (DZIELNICA)

Snippet info

Language

Lua

Visibility

public

Author

nixemlix

Created

2026-06-18T20:35:56.724792Z

Updated

2026-06-18T20:35:56.724792Z

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local localPlayer = Players.LocalPlayer

local MAX_DISTANCE = 11.1

local TIMING = {
	default = 0.32,
	dropkick = 0.50,
	windup = 0.4
}

local STATES = {
	["1swing"] = true,
	["-1swing"] = true,
	["1windupswing"] = true,
	["-1windupswing"] = true,
	["kicking"] = true,
	["dropkicking"] = true,
	["throwdo"] = true,
}

local enabled = false
local holding = false
local currentToken = 0
local lastState = {}

local guiParent = (typeof(gethui) == "function" and gethui()) or game:GetService("CoreGui")

local old = guiParent:FindFirstChild("AutoParryUI")
if old then old:Destroy() end

local gui = Instance.new("ScreenGui")
gui.Name = "AutoParryUI"
gui.ResetOnSpawn = false
gui.Parent = guiParent

local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 200, 0, 70)
frame.Position = UDim2.new(0, 15, 1, -90)
frame.BackgroundColor3 = Color3.fromRGB(35,35,35)
frame.Parent = gui

Instance.new("UICorner", frame).CornerRadius = UDim.new(0,6)

local button = Instance.new("TextButton")
button.Size = UDim2.new(1, -20, 1, -20)
button.Position = UDim2.new(0, 10, 0, 10)
button.Text = "AutoParry: OFF (B)"
button.BackgroundColor3 = Color3.fromRGB(180,50,50)
button.TextColor3 = Color3.fromRGB(255,255,255)
button.Parent = frame

Instance.new("UICorner", button).CornerRadius = UDim.new(0,6)

local function updateUI()
	button.Text = enabled and "AutoParry: ON (B)" or "AutoParry: OFF (B)"
	button.BackgroundColor3 = enabled and Color3.fromRGB(50,200,50) or Color3.fromRGB(180,50,50)
end

button.MouseButton1Click:Connect(function()
	enabled = not enabled
	updateUI()
end)

UserInputService.InputBegan:Connect(function(input, gp)
	if gp then return end
	if input.KeyCode == Enum.KeyCode.B then
		enabled = not enabled
		updateUI()
	end
end)

updateUI()

local function hrp(p)
	local c = p.Character
	return c and c:FindFirstChild("HumanoidRootPart")
end

local function dist(p)
	local a = hrp(localPlayer)
	local b = hrp(p)
	if not a or not b then return math.huge end
	return (a.Position - b.Position).Magnitude
end

local function release()
	currentToken += 1
	holding = false
	mouse2release()
end

local function pressWithTimer(duration)
	currentToken += 1
	local token = currentToken

	if not holding then
		mouse2press()
		holding = true
	end

	task.spawn(function()
		task.wait(duration)

		if token ~= currentToken then return end

		mouse2release()
		holding = false
	end)
end

RunService.RenderStepped:Connect(function()
	if not enabled then return end

	for _, player in ipairs(Players:GetPlayers()) do
		if player ~= localPlayer then

			local stats = player:FindFirstChild("stats")
			local anim = stats and stats:FindFirstChild("animstate")
			local state = anim and anim.Value

			if not state then continue end

			local d = dist(player)

			if lastState[player] == state then
				continue
			end
			lastState[player] = state

			if state == "dropkicking" then
				if d <= MAX_DISTANCE then
					pressWithTimer(TIMING.dropkick)
				end
				continue
			end

			if state == "1windupswing" or state == "-1windupswing" then
				if d <= MAX_DISTANCE then
					pressWithTimer(TIMING.windup)
				end
				continue
			end

			if state == "throwdo" then
				if d <= MAX_DISTANCE then
					pressWithTimer(TIMING.default)
				end
				continue
			end

			if STATES[state] then
				if d <= MAX_DISTANCE then
					pressWithTimer(TIMING.default)
				end
			end

		end
	end
end)
INFO