-- УЛЬТРА-ГРОМКИЙ ХИТСАУНД (Только для ТВОИХ попаданий)
local function startHitSounds()
local cleanup = Cleanup.new()
local enemyHealths = {}
local mouse = client:GetMouse() -- Привязываем мышку/прицел локального игрока
local function trackEnemy(plr)
if plr == client then return end
local function onChar(char)
local hum = char:WaitForChild("Humanoid", 10)
if hum then
enemyHealths[plr] = hum.Health
cleanup:addConnection(hum.HealthChanged:Connect(function(currentHealth)
local lastHealth = enemyHealths[plr] or 100
enemyHealths[plr] = currentHealth
-- Если здоровье упало И функция включена
if currentHealth < lastHealth and features.hitsounds.enabled then
pcall(function()
-- ЖЕСТКИЙ ФИЛЬТР: Проверяем, что в момент падения ХП твой прицел наведен именно на этого врага
local isMyHit = mouse.Target and mouse.Target:IsDescendantOf(char)
if isMyHit then
-- Спавним звук прямо в SoundService (орет на максимум без 3D затухания)
local sound = Instance.new("Sound")
sound.SoundId = SOUNDS_DB[features.hitsounds.type] or SOUNDS_DB.Skeet
sound.Volume = features.hitsounds.volume -- Выкручено на 10-ку
sound.PlayOnRemove = false
sound.Parent = soundService
sound:Play()
debris:AddItem(sound, 1.5) -- Очистка памяти в Xeno
end
pcall(function()
end)
end
end))
end
end
if plr.Character then task_spawn(onChar, plr.Character) end
cleanup:addConnection(plr.CharacterAdded:Connect(onChar))
end
for _, p in ipairs(players:GetPlayers()) do trackEnemy(p) end
cleanup:addConnection(players.PlayerAdded:Connect(trackEnemy))
return cleanup
end