Загрузка данных


local ReplicatedStorage = game:GetService("ReplicatedStorage")

-- ================= НАСТРОЙКИ =================
local Settings = {
	Damage = 35,       -- урон за один удар (у обычного игрока 100 HP)
	Range = 7,         -- дальность удара в стадах
	Width = 6,         -- ширина зоны удара
	HitDelay = 0.3,    -- через сколько секунд после начала анимации засчитывается удар
	Cooldown = 1.4,    -- пауза между ударами (должна быть чуть меньше, чем на клиенте)
}
-- =============================================

local event = Instance.new("RemoteEvent")
event.Name = "TripleKickEvent"
event.Parent = ReplicatedStorage

local lastAttack = {}

event.OnServerEvent:Connect(function(player)
	local char = player.Character
	local hum = char and char:FindFirstChildOfClass("Humanoid")
	local root = char and char:FindFirstChild("HumanoidRootPart")
	if not hum or not root or hum.Health <= 0 then return end

	local now = os.clock()
	if lastAttack[player] and now - lastAttack[player] < Settings.Cooldown then return end
	lastAttack[player] = now

	task.wait(Settings.HitDelay)
	if hum.Health <= 0 or not root.Parent then return end

	local params = OverlapParams.new()
	params.FilterType = Enum.RaycastFilterType.Exclude
	params.FilterDescendantsInstances = { char }

	local cf = root.CFrame * CFrame.new(0, 0, -Settings.Range / 2)
	local size = Vector3.new(Settings.Width, 6, Settings.Range)
	local parts = workspace:GetPartBoundsInBox(cf, size, params)

	local hit = {}
	for _, part in ipairs(parts) do
		local targetHum = part.Parent and part.Parent:FindFirstChildOfClass("Humanoid")
		if targetHum and targetHum.Health > 0 and not hit[targetHum] then
			hit[targetHum] = true
			targetHum:TakeDamage(Settings.Damage)
		end
	end
end)

game:GetService("Players").PlayerRemoving:Connect(function(plr)
	lastAttack[plr] = nil
end)