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


-- Universal Hit Sound (Hitsound) for Xeno Executor
if getgenv().HitSoundLoaded then return end
getgenv().HitSoundLoaded = true

-- Locals
local Players = game:GetService("Players")
local SoundService = game:GetService("SoundService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Debris = game:GetService("Debris")

local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()

-- Audio IDs (verified Roblox asset IDs)
local SoundIDs = {
    ["Skeet (Gamesense)"] = "rbxassetid://9117605735",
    ["Neverlose"] = "rbxassetid://9119574826",
    ["Metallic"] = "rbxassetid://9113829273",
    ["Bubble"] = "rbxassetid://9120381369",
    ["Bonk"] = "rbxassetid://9120381401",
}

-- Settings
local Settings = {
    Enabled = true,
    SelectedSound = "Skeet (Gamesense)",
    Volume = 1,          -- 0 to 5
    DetectionMode = "Remote Hook", -- "Remote Hook" or "Health Monitor"
}

-- UI Setup
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "HitsoundGUI"
ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui")

-- Main frame
local MainFrame = Instance.new("Frame")
MainFrame.Name = "Main"
MainFrame.Size = UDim2.new(0, 280, 0, 220)
MainFrame.Position = UDim2.new(0.5, -140, 0.5, -110)
MainFrame.BackgroundColor3 = Color3.fromRGB(15, 15, 35)
MainFrame.BorderSizePixel = 0
MainFrame.Parent = ScreenGui

-- Title bar
local TitleBar = Instance.new("Frame")
TitleBar.Size = UDim2.new(1, 0, 0, 28)
TitleBar.BackgroundColor3 = Color3.fromRGB(255, 0, 150)
TitleBar.BorderSizePixel = 0
TitleBar.Parent = MainFrame

local Title = Instance.new("TextLabel")
Title.Text = "HIT SOUND"
Title.Size = UDim2.new(1, -30, 1, 0)
Title.Position = UDim2.new(0, 8, 0, 0)
Title.BackgroundTransparency = 1
Title.TextColor3 = Color3.new(1, 1, 1)
Title.Font = Enum.Font.SourceSansBold
Title.TextSize = 14
Title.Parent = TitleBar

local CloseBtn = Instance.new("TextButton")
CloseBtn.Text = "X"
CloseBtn.Size = UDim2.new(0, 28, 1, 0)
CloseBtn.Position = UDim2.new(1, -28, 0, 0)
CloseBtn.BackgroundColor3 = Color3.fromRGB(100, 0, 50)
CloseBtn.TextColor3 = Color3.new(1, 1, 1)
CloseBtn.Font = Enum.Font.SourceSansBold
CloseBtn.TextSize = 14
CloseBtn.Parent = TitleBar
CloseBtn.MouseButton1Click:Connect(function() ScreenGui:Destroy() end)

-- Drag functionality
local dragStart, startPos
TitleBar.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
        dragStart = input.Position
        startPos = MainFrame.Position
        input.Changed:Connect(function()
            if input.UserInputState == Enum.UserInputState.End then dragStart = nil end
        end)
    end
end)
TitleBar.InputChanged:Connect(function(input)
    if dragStart and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
        local delta = input.Position - dragStart
        MainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
    end
end)

-- Content area
local Scroll = Instance.new("ScrollingFrame")
Scroll.Size = UDim2.new(1, 0, 1, -28)
Scroll.Position = UDim2.new(0, 0, 0, 28)
Scroll.BackgroundTransparency = 1
Scroll.BorderSizePixel = 0
Scroll.CanvasSize = UDim2.new(0, 0, 0, 0)
Scroll.AutomaticCanvasSize = Enum.AutomaticSize.Y
Scroll.ScrollBarThickness = 4
Scroll.Parent = MainFrame

local UIList = Instance.new("UIListLayout")
UIList.Padding = UDim.new(0, 6)
UIList.Parent = Scroll

-- Helper to create toggles
local function CreateToggle(name, default, callback)
    local row = Instance.new("Frame")
    row.Size = UDim2.new(1, -10, 0, 30)
    row.BackgroundTransparency = 1
    row.Parent = Scroll

    local label = Instance.new("TextLabel")
    label.Text = name
    label.Size = UDim2.new(0.65, 0, 1, 0)
    label.Position = UDim2.new(0, 8, 0, 0)
    label.BackgroundTransparency = 1
    label.TextColor3 = Color3.new(1, 1, 1)
    label.Font = Enum.Font.SourceSans
    label.TextSize = 13
    label.TextXAlignment = Enum.TextXAlignment.Left
    label.Parent = row

    local btn = Instance.new("TextButton")
    btn.Size = UDim2.new(0, 42, 0, 20)
    btn.Position = UDim2.new(1, -50, 0.5, -10)
    btn.BackgroundColor3 = default and Color3.fromRGB(255, 0, 150) or Color3.fromRGB(45, 45, 70)
    btn.BorderColor3 = Color3.fromRGB(255, 0, 150)
    btn.BorderSizePixel = 1
    btn.TextColor3 = Color3.new(1, 1, 1)
    btn.Font = Enum.Font.SourceSansBold
    btn.TextSize = 12
    btn.AutoButtonColor = false
    btn.Parent = row

    local state = default
    btn.Text = state and "ON" or "OFF"
    btn.MouseButton1Click:Connect(function()
        state = not state
        btn.Text = state and "ON" or "OFF"
        btn.BackgroundColor3 = state and Color3.fromRGB(255, 0, 150) or Color3.fromRGB(45, 45, 70)
        callback(state)
    end)
end

-- Helper to create dropdown
local function CreateDropdown(name, options, default, callback)
    local row = Instance.new("Frame")
    row.Size = UDim2.new(1, -10, 0, 30)
    row.BackgroundTransparency = 1
    row.Parent = Scroll

    local label = Instance.new("TextLabel")
    label.Text = name
    label.Size = UDim2.new(0.4, 0, 1, 0)
    label.Position = UDim2.new(0, 8, 0, 0)
    label.BackgroundTransparency = 1
    label.TextColor3 = Color3.new(1, 1, 1)
    label.Font = Enum.Font.SourceSans
    label.TextSize = 13
    label.TextXAlignment = Enum.TextXAlignment.Left
    label.Parent = row

    local dropdown = Instance.new("TextButton")
    dropdown.Size = UDim2.new(0.5, -20, 0, 22)
    dropdown.Position = UDim2.new(0.42, 5, 0.5, -11)
    dropdown.BackgroundColor3 = Color3.fromRGB(45, 45, 70)
    dropdown.BorderColor3 = Color3.fromRGB(255, 0, 150)
    dropdown.BorderSizePixel = 1
    dropdown.TextColor3 = Color3.new(1, 1, 1)
    dropdown.Font = Enum.Font.SourceSansBold
    dropdown.TextSize = 12
    dropdown.Text = default
    dropdown.Parent = row

    local listOpen = false
    local listFrame = Instance.new("Frame")
    listFrame.Size = UDim2.new(1, 0, 0, #options * 22)
    listFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 45)
    listFrame.BorderSizePixel = 0
    listFrame.Visible = false
    listFrame.Parent = row

    local listLayout = Instance.new("UIListLayout")
    listLayout.Parent = listFrame

    for _, option in ipairs(options) do
        local optBtn = Instance.new("TextButton")
        optBtn.Text = option
        optBtn.Size = UDim2.new(1, 0, 0, 22)
        optBtn.BackgroundColor3 = Color3.fromRGB(35, 35, 60)
        optBtn.TextColor3 = Color3.new(1, 1, 1)
        optBtn.Font = Enum.Font.SourceSans
        optBtn.TextSize = 12
        optBtn.Parent = listFrame
        optBtn.MouseButton1Click:Connect(function()
            dropdown.Text = option
            listFrame.Visible = false
            listOpen = false
            callback(option)
        end)
    end

    dropdown.MouseButton1Click:Connect(function()
        listOpen = not listOpen
        listFrame.Visible = listOpen
    end)
end

-- Helper to create slider
local function CreateSlider(name, min, max, default, callback)
    local row = Instance.new("Frame")
    row.Size = UDim2.new(1, -10, 0, 45)
    row.BackgroundTransparency = 1
    row.Parent = Scroll

    local label = Instance.new("TextLabel")
    label.Text = name .. ": " .. tostring(default)
    label.Size = UDim2.new(1, -10, 0, 16)
    label.Position = UDim2.new(0, 8, 0, 0)
    label.BackgroundTransparency = 1
    label.TextColor3 = Color3.new(1, 1, 1)
    label.Font = Enum.Font.SourceSans
    label.TextSize = 12
    label.TextXAlignment = Enum.TextXAlignment.Left
    label.Parent = row

    local sliderFrame = Instance.new("Frame")
    sliderFrame.Size = UDim2.new(1, -20, 0, 14)
    sliderFrame.Position = UDim2.new(0, 10, 0, 22)
    sliderFrame.BackgroundColor3 = Color3.fromRGB(35, 35, 60)
    sliderFrame.BorderSizePixel = 1
    sliderFrame.BorderColor3 = Color3.fromRGB(255, 0, 150)
    sliderFrame.Parent = row

    local fill = Instance.new("Frame")
    fill.Size = UDim2.new((default - min) / (max - min), 0, 1, 0)
    fill.BackgroundColor3 = Color3.fromRGB(255, 0, 150)
    fill.BorderSizePixel = 0
    fill.Parent = sliderFrame

    local thumb = Instance.new("TextButton")
    thumb.Size = UDim2.new(0, 12, 1, 0)
    thumb.Position = UDim2.new((default - min) / (max - min), -6, 0, 0)
    thumb.BackgroundColor3 = Color3.new(1, 1, 1)
    thumb.BorderSizePixel = 0
    thumb.Text = ""
    thumb.Parent = sliderFrame

    local dragging = false
    thumb.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
            dragging = true
        end
    end)
    game:GetService("UserInputService").InputEnded:Connect(function(input)
        if dragging and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
            dragging = false
        end
    end)
    game:GetService("UserInputService").InputChanged:Connect(function(input)
        if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
            local pos = game:GetService("UserInputService"):GetMouseLocation()
            local relX = pos.X - sliderFrame.AbsolutePosition.X
            local ratio = math.clamp(relX / sliderFrame.AbsoluteSize.X, 0, 1)
            local value = min + (max - min) * ratio
            value = math.floor(value * 10 + 0.5) / 10 -- one decimal
            value = math.clamp(value, min, max)
            thumb.Position = UDim2.new((value - min) / (max - min), -6, 0, 0)
            fill.Size = UDim2.new((value - min) / (max - min), 0, 1, 0)
            label.Text = name .. ": " .. tostring(value)
            callback(value)
        end
    end)
end

-- Play sound helper
local function PlayHitSound()
    if not Settings.Enabled then return end
    local soundId = SoundIDs[Settings.SelectedSound]
    if not soundId then return end

    local sound = Instance.new("Sound")
    sound.SoundId = soundId
    sound.Volume = Settings.Volume
    sound.Parent = SoundService
    sound:Play()

    Debris:AddItem(sound, 2)
end

-- Detection method 1: Hook RemoteEvents
local hookedRemotes = {}
local function HookRemotes()
    for _, obj in ipairs(ReplicatedStorage:GetDescendants()) do
        if obj:IsA("RemoteEvent") and not hookedRemotes[obj] then
            local name = obj.Name:lower()
            if name:find("hit") or name:find("damage") or name:find("shoot") or name:find("fire") then
                -- Hook FireServer
                local oldFire = obj.FireServer
                obj.FireServer = function(self, ...)
                    -- Only if the local player is the one firing (since it's a client remote)
                    if self == obj then
                        PlayHitSound()
                    end
                    return oldFire(self, ...)
                end
                hookedRemotes[obj] = true
            end
        end
    end
end

-- Detection method 2: Health Monitor
local lastHealth = {}
local healthMonitorConn
local function StartHealthMonitor()
    -- Initialize health track
    for _, player in ipairs(Players:GetPlayers()) do
        if player ~= LocalPlayer and player.Character and player.Character:FindFirstChild("Humanoid") then
            lastHealth[player] = player.Character.Humanoid.Health
        end
    end
    healthMonitorConn = RunService.RenderStepped:Connect(function()
        for _, player in ipairs(Players:GetPlayers()) do
            if player ~= LocalPlayer and player.Character and player.Character:FindFirstChild("Humanoid") then
                local hum = player.Character.Humanoid
                local prev = lastHealth[player]
                if prev and hum.Health < prev then
                    PlayHitSound()
                end
                lastHealth[player] = hum.Health
            else
                lastHealth[player] = nil
            end
        end
    end)
end

local function StopHealthMonitor()
    if healthMonitorConn then
        healthMonitorConn:Disconnect()
        healthMonitorConn = nil
    end
end

-- Handle detection mode changes
local detectionModeToggle
local function SetDetectionMode(mode)
    Settings.DetectionMode = mode
    if mode == "Remote Hook" then
        StopHealthMonitor()
        HookRemotes() -- re-hook if new remotes appeared
        -- Continue scanning for new remotes
        spawn(function()
            while Settings.DetectionMode == "Remote Hook" do
                HookRemotes()
                task.wait(2)
            end
        end)
    else
        StartHealthMonitor()
    end
end

-- UI Elements
CreateToggle("Enable Hitsound", true, function(state)
    Settings.Enabled = state
end)

CreateDropdown("Sound", {"Skeet (Gamesense)", "Neverlose", "Metallic", "Bubble", "Bonk"}, "Skeet (Gamesense)", function(choice)
    Settings.SelectedSound = choice
end)

CreateSlider("Volume", 0, 5, 1, function(val)
    Settings.Volume = val
end)

CreateDropdown("Detection", {"Remote Hook", "Health Monitor"}, "Remote Hook", function(mode)
    SetDetectionMode(mode)
end)

-- Start with default mode
SetDetectionMode("Remote Hook")