Murder Mystery 2 Script YalaHub - Role ESP, Dropped Gun ESP
NO KEY 37
Mobile ready
Murder Mystery 2

Murder Mystery 2 Script YalaHub - Role ESP, Dropped Gun ESP

YalaHub for Murder Mystery 2 highlights player roles and dropped guns, with optional names, distance labels, health bars and customizable ESP styles

PUBLISHERenzyUpdated 1 day ago
Script developerYalaHub
Play Game
NO KEYMobilePC Mobile ready
More
ADVERTISEMENT
TOTAL VIEWS37Views recorded for this script page
SCRIPT UPDATED10/28/2026Latest recorded update for this script
REVIEW STATUSSource information reviewedReview information is a version-specific snapshot, not a permanent safety guarantee. Lua Obfuscator Loadstring Generator URL Checker
VERIFICATION PROCESSHow We Review Roblox ScriptsSee the workflow used to examine source links, loadstrings, Lua code, and compatibility information.
Murder Mystery 2Explore more Murder Mystery 2
OVERVIEW

Description

🎯YalaHub for Murder Mystery 2 includes visual tools for identifying player roles, locating dropped Sheriff guns and displaying player information during rounds

The Visuals tab lets you choose which details appear on screen, including player names, role labels, distance in meters and vertical health bars

You can also enable grey highlighting during the lobby phase and choose between filled highlights, outlines or both, adjusting the ESP display to your preferences

Murder Mystery 2

Features

⚡The Visuals section keeps the main ESP controls together, with individual toggles for role highlighting, player names, role text, distance and health

Dropped Gun ESP highlights Sheriff guns on the ground, while Lobby Grey applies grey highlighting during the lobby phase

The ESP Fill Mode buttons let you switch between Fill, Outline and Both, and the interface displays K as its toggle shortcut

1

Role ESP - Highlights players according to their role so you can distinguish the Murderer, Sheriff and Innocents

2

Dropped Gun ESP - Highlights dropped Sheriff guns so you can locate them on the map

3

Show Name - Displays player names above their characters

4

Show Role - Adds role text to the player ESP display

Script Preview1038 lines · 42114 B
Raw
--!strict
-- LocalScript (StarterPlayerScripts)
-- yalahub — MM2 Edition v3.7 (fixed tabs)

local Players          = game:GetService("Players")
local RunService       = game:GetService("RunService")
local TweenService     = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local HttpService      = game:GetService("HttpService")
local Lighting         = game:GetService("Lighting")
local SoundService     = game:GetService("SoundService")

local LocalPlayer = Players.LocalPlayer
local PlayerGui   = LocalPlayer:WaitForChild("PlayerGui")
local Camera      = workspace.CurrentCamera

-- ═══ GLOBAL STATE ═══
local genv = (typeof(getgenv) == "function" and getgenv()) or _G
if genv.__yalahub_conns then
    for _, c in ipairs(genv.__yalahub_conns) do pcall(function() c:Disconnect() end) end
end
if genv.__yalahub_drawings then
    for _, d in ipairs(genv.__yalahub_drawings) do pcall(function() d:Remove() end) end
end
local Connections = {}
genv.__yalahub_conns = Connections
local Drawings = {}
genv.__yalahub_drawings = Drawings
local function addConn(c) table.insert(Connections, c); return c end
local function addDrawing(d) table.insert(Drawings, d); return d end

for _, g in ipairs({ "yalahub_Loading", "yalahub_Menu", "yalahub_Aim", "yalahub_Notifs" }) do
    local old = PlayerGui:FindFirstChild(g)
    if old then old:Destroy() end
end

-- ═══ CONFIG ═══
local CONFIG = {
    SIZE_X = 0.60, SIZE_Y = 0.62,
    WHITE = Color3.fromRGB(255, 255, 255),
    AIM_TARGET = Color3.fromRGB(255, 100, 100),
    ROLE_MURDERER = Color3.fromRGB(255, 65, 65),
    ROLE_SHERIFF  = Color3.fromRGB(65, 145, 255),
    ROLE_INNOCENT = Color3.fromRGB(80, 220, 120),
    ROLE_UNKNOWN  = Color3.fromRGB(180, 180, 185),
    LOBBY_GREY    = Color3.fromRGB(130, 130, 135),
    DROPPED_GUN   = Color3.fromRGB(65, 145, 255),
    NOTIF_ON  = Color3.fromRGB(80, 220, 120),
    NOTIF_OFF = Color3.fromRGB(255, 80, 80),
    OPEN   = TweenInfo.new(0.38, Enum.EasingStyle.Quart, Enum.EasingDirection.Out),
    CLOSE  = TweenInfo.new(0.22, Enum.EasingStyle.Quart, Enum.EasingDirection.In),
    FAST   = TweenInfo.new(0.15, Enum.EasingStyle.Quad,  Enum.EasingDirection.Out),
    SMOOTH = TweenInfo.new(0.22, Enum.EasingStyle.Quart, Enum.EasingDirection.Out),
    TOGGLE = TweenInfo.new(0.32, Enum.EasingStyle.Quart, Enum.EasingDirection.Out),
    NOTIF  = TweenInfo.new(0.35, Enum.EasingStyle.Back,  Enum.EasingDirection.Out),
}

local hasDrawing = false
pcall(function()
    local s = Drawing.new("Square")
    s:Remove()
    hasDrawing = true
end)

-- ═══ CORNERS ═══
local trackedCorners = {}
local noCorners = false
local function createCorner(parent, radius)
    local c = Instance.new("UICorner")
    local target = UDim.new(0, radius)
    c.CornerRadius = target
    c.Parent = parent
    trackedCorners[c] = target
    if noCorners then c.CornerRadius = UDim.new(0, 0) end
    return c
end
local function createCircleCorner(parent)
    local c = Instance.new("UICorner")
    local target = UDim.new(1, 0)
    c.CornerRadius = target
    c.Parent = parent
    trackedCorners[c] = target
    if noCorners then c.CornerRadius = UDim.new(0, 0) end
    return c
end
local function setNoCorners(state)
    noCorners = state
    for corner, orig in pairs(trackedCorners) do
        if corner and corner.Parent then
            corner.CornerRadius = state and UDim.new(0, 0) or orig
        end
    end
end

-- ═══ THEMES ═══
local THEMES = {
    Monochrome = {
        Label = "Monochrome",
        BgBase = Color3.fromRGB(6, 6, 6),
        BgGradient = ColorSequence.new({
            ColorSequenceKeypoint.new(0.00, Color3.fromRGB(0, 0, 0)),
            ColorSequenceKeypoint.new(0.40, Color3.fromRGB(15, 15, 15)),
            ColorSequenceKeypoint.new(0.50, Color3.fromRGB(85, 85, 85)),
            ColorSequenceKeypoint.new(0.60, Color3.fromRGB(15, 15, 15)),
            ColorSequenceKeypoint.new(1.00, Color3.fromRGB(0, 0, 0)),
        }),
        TabBarBg = Color3.fromRGB(4, 4, 4), ContentBg = Color3.fromRGB(10, 10, 10),
        RowBg = Color3.fromRGB(32, 32, 32), TrackOff = Color3.fromRGB(42, 42, 42),
        AccentA = Color3.fromRGB(210, 210, 210), AccentB = Color3.fromRGB(255, 255, 255),
        AccentTrack = Color3.fromRGB(50, 50, 50), Divider = Color3.fromRGB(120, 120, 120),
        Text = Color3.fromRGB(250, 250, 250), TextDim = Color3.fromRGB(180, 180, 180), TextMute = Color3.fromRGB(105, 105, 105),
    },
    Sakura = {
        Label = "Sakura Bloom",
        BgBase = Color3.fromRGB(18, 8, 14),
        BgGradient = ColorSequence.new({
            ColorSequenceKeypoint.new(0.00, Color3.fromRGB(0, 0, 0)),
            ColorSequenceKeypoint.new(0.40, Color3.fromRGB(35, 16, 26)),
            ColorSequenceKeypoint.new(0.50, Color3.fromRGB(140, 70, 110)),
            ColorSequenceKeypoint.new(0.60, Color3.fromRGB(35, 16, 26)),
            ColorSequenceKeypoint.new(1.00, Color3.fromRGB(0, 0, 0)),
        }),
        TabBarBg = Color3.fromRGB(14, 4, 10), ContentBg = Color3.fromRGB(24, 10, 18),
        RowBg = Color3.fromRGB(60, 25, 45), TrackOff = Color3.fromRGB(58, 32, 48),
        AccentA = Color3.fromRGB(240, 120, 170), AccentB = Color3.fromRGB(255, 180, 210),
        AccentTrack = Color3.fromRGB(65, 20, 40), Divider = Color3.fromRGB(230, 150, 180),
        Text = Color3.fromRGB(255, 245, 250), TextDim = Color3.fromRGB(225, 175, 200), TextMute = Color3.fromRGB(150, 100, 125),
    },
    Violet = {
        Label = "Violet Crystal",
        BgBase = Color3.fromRGB(8, 6, 16),
        BgGradient = ColorSequence.new({
            ColorSequenceKeypoint.new(0.00, Color3.fromRGB(0, 0, 0)),
            ColorSequenceKeypoint.new(0.40, Color3.fromRGB(20, 16, 30)),
            ColorSequenceKeypoint.new(0.50, Color3.fromRGB(65, 50, 90)),
            ColorSequenceKeypoint.new(0.60, Color3.fromRGB(20, 16, 30)),
            ColorSequenceKeypoint.new(1.00, Color3.fromRGB(0, 0, 0)),
        }),
        TabBarBg = Color3.fromRGB(6, 4, 14), ContentBg = Color3.fromRGB(11, 8, 20),
        RowBg = Color3.fromRGB(32, 24, 50), TrackOff = Color3.fromRGB(42, 36, 58),
        AccentA = Color3.fromRGB(120, 70, 220), AccentB = Color3.fromRGB(185, 120, 255),
        AccentTrack = Color3.fromRGB(35, 25, 55), Divider = Color3.fromRGB(140, 110, 200),
        Text = Color3.fromRGB(240, 240, 248), TextDim = Color3.fromRGB(165, 150, 195), TextMute = Color3.fromRGB(95, 82, 120),
    },
    Ocean = {
        Label = "Deep Ocean",
        BgBase = Color3.fromRGB(5, 12, 22),
        BgGradient = ColorSequence.new({
            ColorSequenceKeypoint.new(0.00, Color3.fromRGB(0, 0, 0)),
            ColorSequenceKeypoint.new(0.40, Color3.fromRGB(10, 24, 40)),
            ColorSequenceKeypoint.new(0.50, Color3.fromRGB(40, 110, 160)),
            ColorSequenceKeypoint.new(0.60, Color3.fromRGB(10, 24, 40)),
            ColorSequenceKeypoint.new(1.00, Color3.fromRGB(0, 0, 0)),
        }),
        TabBarBg = Color3.fromRGB(3, 10, 18), ContentBg = Color3.fromRGB(7, 16, 28),
        RowBg = Color3.fromRGB(22, 50, 78), TrackOff = Color3.fromRGB(32, 52, 70),
        AccentA = Color3.fromRGB(30, 130, 220), AccentB = Color3.fromRGB(90, 205, 255),
        AccentTrack = Color3.fromRGB(12, 36, 60), Divider = Color3.fromRGB(90, 160, 210),
        Text = Color3.fromRGB(235, 245, 252), TextDim = Color3.fromRGB(145, 180, 210), TextMute = Color3.fromRGB(75, 105, 135),
    },
    Blood = {
        Label = "Blood Moon",
        BgBase = Color3.fromRGB(16, 3, 3),
        BgGradient = ColorSequence.new({
            ColorSequenceKeypoint.new(0.00, Color3.fromRGB(0, 0, 0)),
            ColorSequenceKeypoint.new(0.40, Color3.fromRGB(35, 10, 10)),
            ColorSequenceKeypoint.new(0.50, Color3.fromRGB(115, 32, 32)),
            ColorSequenceKeypoint.new(0.60, Color3.fromRGB(35, 10, 10)),
            ColorSequenceKeypoint.new(1.00, Color3.fromRGB(0, 0, 0)),
        }),
        TabBarBg = Color3.fromRGB(12, 2, 2), ContentBg = Color3.fromRGB(22, 5, 5),
        RowBg = Color3.fromRGB(55, 16, 16), TrackOff = Color3.fromRGB(58, 25, 25),
        AccentA = Color3.fromRGB(190, 30, 30), AccentB = Color3.fromRGB(255, 85, 85),
        AccentTrack = Color3.fromRGB(58, 12, 12), Divider = Color3.fromRGB(210, 100, 100),
        Text = Color3.fromRGB(250, 235, 235), TextDim = Color3.fromRGB(205, 155, 155), TextMute = Color3.fromRGB(125, 75, 75),
    },
    Emerald = {
        Label = "Emerald Forest",
        BgBase = Color3.fromRGB(4, 14, 8),
        BgGradient = ColorSequence.new({
            ColorSequenceKeypoint.new(0.00, Color3.fromRGB(0, 0, 0)),
            ColorSequenceKeypoint.new(0.40, Color3.fromRGB(10, 28, 16)),
            ColorSequenceKeypoint.new(0.50, Color3.fromRGB(35, 105, 62)),
            ColorSequenceKeypoint.new(0.60, Color3.fromRGB(10, 28, 16)),
            ColorSequenceKeypoint.new(1.00, Color3.fromRGB(0, 0, 0)),
        }),
        TabBarBg = Color3.fromRGB(3, 10, 6), ContentBg = Color3.fromRGB(6, 18, 12),
        RowBg = Color3.fromRGB(20, 55, 38), TrackOff = Color3.fromRGB(30, 55, 45),
        AccentA = Color3.fromRGB(40, 180, 100), AccentB = Color3.fromRGB(120, 240, 170),
        AccentTrack = Color3.fromRGB(15, 45, 30), Divider = Color3.fromRGB(95, 180, 130),
        Text = Color3.fromRGB(230, 250, 235), TextDim = Color3.fromRGB(145, 200, 165), TextMute = Color3.fromRGB(70, 115, 90),
    },
    Sunset = {
        Label = "Sunset Gold",
        BgBase = Color3.fromRGB(18, 10, 4),
        BgGradient = ColorSequence.new({
            ColorSequenceKeypoint.new(0.00, Color3.fromRGB(0, 0, 0)),
            ColorSequenceKeypoint.new(0.40, Color3.fromRGB(40, 20, 8)),
            ColorSequenceKeypoint.new(0.50, Color3.fromRGB(150, 80, 30)),
            ColorSequenceKeypoint.new(0.60, Color3.fromRGB(40, 20, 8)),
            ColorSequenceKeypoint.new(1.00, Color3.fromRGB(0, 0, 0)),
        }),
        TabBarBg = Color3.fromRGB(14, 6, 2), ContentBg = Color3.fromRGB(24, 14, 6),
        RowBg = Color3.fromRGB(65, 38, 14), TrackOff = Color3.fromRGB(55, 38, 22),
        AccentA = Color3.fromRGB(240, 140, 30), AccentB = Color3.fromRGB(255, 200, 80),
        AccentTrack = Color3.fromRGB(60, 30, 10), Divider = Color3.fromRGB(230, 165, 90),
        Text = Color3.fromRGB(255, 245, 230), TextDim = Color3.fromRGB(220, 175, 130), TextMute = Color3.fromRGB(140, 100, 60),
    },
    Cyberpunk = {
        Label = "Cyberpunk",
        BgBase = Color3.fromRGB(10, 4, 16),
        BgGradient = ColorSequence.new({
            ColorSequenceKeypoint.new(0.00, Color3.fromRGB(0, 0, 0)),
            ColorSequenceKeypoint.new(0.40, Color3.fromRGB(25, 8, 35)),
            ColorSequenceKeypoint.new(0.50, Color3.fromRGB(120, 20, 130)),
            ColorSequenceKeypoint.new(0.60, Color3.fromRGB(25, 8, 35)),
            ColorSequenceKeypoint.new(1.00, Color3.fromRGB(0, 0, 0)),
        }),
        TabBarBg = Color3.fromRGB(8, 2, 14), ContentBg = Color3.fromRGB(14, 6, 22),
        RowBg = Color3.fromRGB(50, 18, 65), TrackOff = Color3.fromRGB(45, 25, 60),
        AccentA = Color3.fromRGB(255, 30, 190), AccentB = Color3.fromRGB(100, 220, 255),
        AccentTrack = Color3.fromRGB(45, 12, 60), Divider = Color3.fromRGB(200, 80, 220),
        Text = Color3.fromRGB(250, 240, 255), TextDim = Color3.fromRGB(190, 150, 220), TextMute = Color3.fromRGB(110, 75, 140),
    },
}
local THEME_ORDER = { "Monochrome", "Sakura", "Violet", "Ocean", "Blood", "Emerald", "Sunset", "Cyberpunk" }

-- ═══ CONFIG FILE ═══
local function getExecutorFn(name)
    local ok, fn = pcall(function() return rawget(_G, name) end)
    if ok and type(fn) == "function" then return fn end
    ok, fn = pcall(function() return genv[name] end)
    if ok and type(fn) == "function" then return fn end
    ok, fn = pcall(function() local env = getfenv(); return env and env[name] or nil end)
    if ok and type(fn) == "function" then return fn end
    return nil
end
local writefile_func  = getExecutorFn("writefile")
local readfile_func   = getExecutorFn("readfile")
local isfile_func     = getExecutorFn("isfile")
local makefolder_func = getExecutorFn("makefolder")
local isfolder_func   = getExecutorFn("isfolder")
local CONFIG_PATHS = { "yalahub_mm2.json", "Yalahub/yalahub_mm2.json" }

local function tryMakeFolder(path)
    if not makefolder_func or not isfolder_func then return end
    local folder = path:match("^(.*)/[^/]+$")
    if not folder then return end
    local ok, exists = pcall(isfolder_func, folder)
    if ok and not exists then pcall(makefolder_func, folder) end
end
local function findActivePath()
    if not isfile_func then return nil end
    for _, p in ipairs(CONFIG_PATHS) do
        local ok, exists = pcall(isfile_func, p)
        if ok and exists then return p end
    end
    return nil
end

local Config = { Data = { theme = "Monochrome", toggles = {}, sliders = {}, binds = {}, options = {} } }

local function loadConfigFile()
    if not readfile_func then
        if type(genv.__yalahub_config) == "table" then Config.Data = genv.__yalahub_config end
        return
    end
    local path = findActivePath()
    if not path then return end
    local rOk, content = pcall(readfile_func, path)
    if not rOk or type(content) ~= "string" or content == "" then return end
    local dOk, data = pcall(function() return HttpService:JSONDecode(content) end)
    if not dOk or type(data) ~= "table" then return end
    if type(data.theme) == "string" and THEMES[data.theme] then Config.Data.theme = data.theme end
    if type(data.toggles) == "table" then Config.Data.toggles = data.toggles end
    if type(data.sliders) == "table" then Config.Data.sliders = data.sliders end
    if type(data.binds)   == "table" then Config.Data.binds   = data.binds   end
    if type(data.options) == "table" then Config.Data.options = data.options end
end

local function performWrite()
    genv.__yalahub_config = Config.Data
    if not writefile_func then return false end
    local encoded
    local ok = pcall(function() encoded = HttpService:JSONEncode(Config.Data) end)
    if not ok or not encoded then return false end
    for _, path in ipairs(CONFIG_PATHS) do
        tryMakeFolder(path)
        if pcall(writefile_func, path, encoded) then return true end
    end
    return false
end

local lastSaveTime = 0
local pendingSaveTask = nil
local function saveConfig(force)
    if force then lastSaveTime = os.clock(); performWrite(); return end
    if pendingSaveTask then return end
    local elapsed = os.clock() - lastSaveTime
    if elapsed >= 0.3 then
        lastSaveTime = os.clock()
        performWrite()
    else
        pendingSaveTask = task.delay(0.3 - elapsed, function()
            pendingSaveTask = nil
            lastSaveTime = os.clock()
            performWrite()
        end)
    end
end

loadConfigFile()
local currentThemeName = Config.Data.theme
if not THEMES[currentThemeName] then currentThemeName = "Monochrome" end
local currentTheme = THEMES[currentThemeName]

local themeTargets = {}
local themeButtons = {}
local toggleRegistry = {}
local function registerThemeable(fn) table.insert(themeTargets, fn) end

-- ═══ LOADING ═══
local function createLoadingScreen()
    local gui = Instance.new("ScreenGui")
    gui.Name = "yalahub_Loading"
    gui.ResetOnSpawn = false
    gui.IgnoreGuiInset = true
    gui.DisplayOrder = 999
    gui.Parent = PlayerGui

    local bg = Instance.new("Frame")
    bg.Size = UDim2.fromScale(1, 1)
    bg.BackgroundColor3 = Color3.new(0, 0, 0)
    bg.BorderSizePixel = 0
    bg.Parent = gui

    local brand = Instance.new("TextLabel")
    brand.AnchorPoint = Vector2.new(0.5, 0.5)
    brand.Position = UDim2.fromScale(0.5, 0.5)
    brand.Size = UDim2.fromOffset(400, 70)
    brand.BackgroundTransparency = 1
    brand.Font = Enum.Font.GothamBold
    brand.Text = "yalahub"
    brand.TextColor3 = currentTheme.AccentB
    brand.TextSize = 48
    brand.TextTransparency = 1
    brand.Parent = bg

    local sub = Instance.new("TextLabel")
    sub.AnchorPoint = Vector2.new(0.5, 0)
    sub.Position = UDim2.new(0.5, 0, 0.5, 40)
    sub.Size = UDim2.fromOffset(400, 18)
    sub.BackgroundTransparency = 1
    sub.Font = Enum.Font.GothamMedium
    sub.Text = "loading  ·  mm2 v3.7"
    sub.TextColor3 = currentTheme.TextDim
    sub.TextSize = 13
    sub.TextTransparency = 1
    sub.Parent = bg

    local track = Instance.new("Frame")
    track.AnchorPoint = Vector2.new(0.5, 0)
    track.Position = UDim2.new(0.5, 0, 0.5, 76)
    track.Size = UDim2.fromOffset(260, 3)
    track.BackgroundColor3 = Color3.fromRGB(24, 22, 28)
    track.BackgroundTransparency = 1
    track.BorderSizePixel = 0
    track.Parent = bg
    createCircleCorner(track)

    local fill = Instance.new("Frame")
    fill.Size = UDim2.fromScale(0, 1)
    fill.BackgroundColor3 = Color3.new(1, 1, 1)
    fill.BorderSizePixel = 0
    fill.Parent = track
    createCircleCorner(fill)

    local grad = Instance.new("UIGradient")
    grad.Color = ColorSequence.new({
        ColorSequenceKeypoint.new(0.0, currentTheme.AccentA),
        ColorSequenceKeypoint.new(1.0, currentTheme.AccentB),
    })
    grad.Parent = fill

    task.delay(4, function() if gui and gui.Parent then gui:Destroy() end end)
    task.spawn(function()
        TweenService:Create(brand, TweenInfo.new(0.6), { TextTransparency = 0 }):Play()
        TweenService:Create(sub,   TweenInfo.new(0.6), { TextTransparency = 0 }):Play()
        TweenService:Create(track, TweenInfo.new(0.6), { BackgroundTransparency = 0 }):Play()
        TweenService:Create(fill, TweenInfo.new(2.6, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), { Size = UDim2.fromScale(1, 1) }):Play()
        task.wait(3)
        TweenService:Create(bg,    TweenInfo.new(0.4), { BackgroundTransparency = 1 }):Play()
        TweenService:Create(brand, TweenInfo.new(0.35), { TextTransparency = 1 }):Play()
        TweenService:Create(sub,   TweenInfo.new(0.35), { TextTransparency = 1 }):Play()
        TweenService:Create(track, TweenInfo.new(0.35), { BackgroundTransparency = 1 }):Play()
        task.wait(0.45)
        if gui and gui.Parent then gui:Destroy() end
    end)
end
createLoadingScreen()

-- ═══ NOTIFICATIONS ═══
local notifGui = Instance.new("ScreenGui")
notifGui.Name = "yalahub_Notifs"
notifGui.ResetOnSpawn = false
notifGui.IgnoreGuiInset = true
notifGui.DisplayOrder = 250
notifGui.Parent = PlayerGui

local notifContainer = Instance.new("Frame")
notifContainer.AnchorPoint = Vector2.new(1, 0)
notifContainer.Position = UDim2.new(1, -20, 0, 20)
notifContainer.Size = UDim2.fromOffset(300, 500)
notifContainer.BackgroundTransparency = 1
notifContainer.Parent = notifGui

local activeNotifs = {}
local function reflowNotifs()
    for i, n in ipairs(activeNotifs) do
        TweenService:Create(n, CONFIG.SMOOTH, { Position = UDim2.new(1, 0, 0, (i - 1) * 56) }):Play()
    end
end
local function dismissNotif(n)
    for i, v in ipairs(activeNotifs) do
        if v == n then table.remove(activeNotifs, i); break end
    end
    local y = n.Position.Y.Offset
    TweenService:Create(n, TweenInfo.new(0.28, Enum.EasingStyle.Quart, Enum.EasingDirection.In), {
        Position = UDim2.new(1, 280, 0, y), BackgroundTransparency = 1,
    }):Play()
    for _, c in ipairs(n:GetDescendants()) do
        if c:IsA("TextLabel") then TweenService:Create(c, TweenInfo.new(0.2), { TextTransparency = 1 }):Play()
        elseif c:IsA("Frame") and c ~= n then TweenService:Create(c, TweenInfo.new(0.2), { BackgroundTransparency = 1 }):Play() end
    end
    task.delay(0.32, function() if n then n:Destroy() end; reflowNotifs() end)
end
local function showNotification(text, kind)
    local accent = currentTheme.AccentB
    if kind == "off" then accent = CONFIG.NOTIF_OFF
    elseif kind == "on" then accent = CONFIG.NOTIF_ON end

    local n = Instance.new("Frame")
    n.AnchorPoint = Vector2.new(1, 0)
    n.Size = UDim2.fromOffset(250, 48)
    n.Position = UDim2.new(1, 280, 0, 0)
    n.BackgroundColor3 = Color3.fromRGB(22, 20, 30)
    n.BackgroundTransparency = 0.05
    n.BorderSizePixel = 0
    n.ZIndex = 200
    n.Parent = notifContainer
    createCorner(n, 10)

    local stroke = Instance.new("UIStroke")
    stroke.Color = accent
    stroke.Thickness = 1
    stroke.Transparency = 0.55
    stroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
    stroke.Parent = n

    local glow = Instance.new("Frame")
    glow.Size = UDim2.new(0, 4, 1, 0)
    glow.BackgroundColor3 = accent
    glow.BorderSizePixel = 0
    glow.ZIndex = 201
    glow.Parent = n
    createCorner(glow, 10)

    local label = Instance.new("TextLabel")
    label.BackgroundTransparency = 1
    label.Position = UDim2.fromOffset(18, 0)
    label.Size = UDim2.new(1, -30, 1, 0)
    label.Font = Enum.Font.GothamMedium
    label.Text = text
    label.TextColor3 = Color3.fromRGB(245, 245, 250)
    label.TextSize = 13
    label.TextXAlignment = Enum.TextXAlignment.Left
    label.TextTruncate = Enum.TextTruncate.AtEnd
    label.ZIndex = 202
    label.Parent = n

    table.insert(activeNotifs, n)
    TweenService:Create(n, CONFIG.NOTIF, { Position = UDim2.new(1, 0, 0, (#activeNotifs - 1) * 56) }):Play()
    task.delay(2.5, function() if n and n.Parent then dismissNotif(n) end end)
end

-- ═══ MENU ROOT ═══
local GUI_NAME = "yalahub_Menu"
local oldGui = PlayerGui:FindFirstChild(GUI_NAME)
if oldGui then oldGui:Destroy() end

local screenGui = Instance.new("ScreenGui")
screenGui.Name = GUI_NAME
screenGui.ResetOnSpawn = false
screenGui.IgnoreGuiInset = true
screenGui.DisplayOrder = 100
screenGui.Enabled = false
screenGui.Parent = PlayerGui

local shadow = Instance.new("Frame")
shadow.AnchorPoint = Vector2.new(0.5, 0.5)
shadow.Position = UDim2.fromScale(0.5, 0.5)
shadow.Size = UDim2.new(CONFIG.SIZE_X, 16, CONFIG.SIZE_Y, 16)
shadow.BackgroundColor3 = Color3.new(0, 0, 0)
shadow.BackgroundTransparency = 0.6
shadow.BorderSizePixel = 0
shadow.ZIndex = 1
shadow.Parent = screenGui
createCorner(shadow, 14)

local root = Instance.new("Frame")
root.AnchorPoint = Vector2.new(0.5, 0.5)
root.Position = UDim2.fromScale(0.5, 0.5)
root.Size = UDim2.fromScale(CONFIG.SIZE_X, CONFIG.SIZE_Y)
root.BackgroundColor3 = currentTheme.BgBase
root.BorderSizePixel = 0
root.ClipsDescendants = true
root.ZIndex = 2
root.Parent = screenGui
createCorner(root, 12)

local rootStroke = Instance.new("UIStroke")
rootStroke.Color = currentTheme.AccentB
rootStroke.Thickness = 1
rootStroke.Transparency = 0.75
rootStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
rootStroke.Parent = root

local bgGrad = Instance.new("UIGradient")
bgGrad.Color = currentTheme.BgGradient
bgGrad.Rotation = 135
bgGrad.Parent = root

local HEADER_H = 72

-- Header glow
local headerGlow = Instance.new("Frame")
headerGlow.BackgroundColor3 = currentTheme.AccentA
headerGlow.BackgroundTransparency = 0.85
headerGlow.BorderSizePixel = 0
headerGlow.Size = UDim2.new(1, 0, 0, HEADER_H)
headerGlow.ZIndex = 3
headerGlow.Parent = root
local hgGrad = Instance.new("UIGradient")
hgGrad.Transparency = NumberSequence.new({
    NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(1, 0.65),
})
hgGrad.Rotation = 90
hgGrad.Parent = headerGlow

local title = Instance.new("TextLabel")
title.BackgroundTransparency = 1
title.Position = UDim2.fromOffset(28, 18)
title.Size = UDim2.new(1, -120, 0, 26)
title.Font = Enum.Font.GothamBold
title.Text = "yalahub"
title.TextColor3 = currentTheme.Text
title.TextSize = 22
title.TextXAlignment = Enum.TextXAlignment.Left
title.ZIndex = 4
title.Parent = root

local subtitle = Instance.new("TextLabel")
subtitle.BackgroundTransparency = 1
subtitle.Position = UDim2.fromOffset(29, 45)
subtitle.Size = UDim2.new(1, -120, 0, 14)
subtitle.Font = Enum.Font.Gotham
subtitle.Text = "mm2 edition  ·  K to toggle"
subtitle.TextColor3 = currentTheme.TextMute
subtitle.TextSize = 11
subtitle.TextXAlignment = Enum.TextXAlignment.Left
subtitle.ZIndex = 4
subtitle.Parent = root

local closeBtn = Instance.new("TextButton")
closeBtn.AnchorPoint = Vector2.new(1, 0)
closeBtn.Position = UDim2.new(1, -18, 0, 18)
closeBtn.Size = UDim2.fromOffset(30, 30)
closeBtn.BackgroundColor3 = currentTheme.RowBg
closeBtn.BackgroundTransparency = 0.4
closeBtn.Text = "✕"
closeBtn.TextColor3 = currentTheme.TextDim
closeBtn.TextSize = 14
closeBtn.Font = Enum.Font.GothamBold
closeBtn.AutoButtonColor = false
closeBtn.ZIndex = 4
closeBtn.Parent = root
createCorner(closeBtn, 6)
addConn(closeBtn.MouseEnter:Connect(function()
    TweenService:Create(closeBtn, CONFIG.FAST, { TextColor3 = currentTheme.Text, BackgroundTransparency = 0.2 }):Play()
end))
addConn(closeBtn.MouseLeave:Connect(function()
    TweenService:Create(closeBtn, CONFIG.FAST, { TextColor3 = currentTheme.TextDim, BackgroundTransparency = 0.4 }):Play()
end))

local headerLine = Instance.new("Frame")
headerLine.BackgroundColor3 = currentTheme.Divider
headerLine.BackgroundTransparency = 0.75
headerLine.BorderSizePixel = 0
headerLine.Position = UDim2.fromOffset(0, HEADER_H)
headerLine.Size = UDim2.new(1, 0, 0, 1)
headerLine.ZIndex = 3
headerLine.Parent = root

-- Tab bar
local TABBAR_W = 168
local TABBAR_Y = HEADER_H + 1

local tabBar = Instance.new("Frame")
tabBar.BackgroundColor3 = currentTheme.TabBarBg
tabBar.BackgroundTransparency = 0.2
tabBar.BorderSizePixel = 0
tabBar.Position = UDim2.fromOffset(0, TABBAR_Y)
tabBar.Size = UDim2.new(0, TABBAR_W, 1, -TABBAR_Y)
tabBar.ZIndex = 2
tabBar.Parent = root

local vDiv = Instance.new("Frame")
vDiv.BackgroundColor3 = currentTheme.Divider
vDiv.BackgroundTransparency = 0.85
vDiv.BorderSizePixel = 0
vDiv.AnchorPoint = Vector2.new(1, 0)
vDiv.Position = UDim2.new(1, 0, 0, 0)
vDiv.Size = UDim2.new(0, 1, 1, 0)
vDiv.ZIndex = 3
vDiv.Parent = tabBar

local tabList = Instance.new("Frame")
tabList.BackgroundTransparency = 1
tabList.Position = UDim2.fromOffset(14, 16)
tabList.Size = UDim2.new(1, -28, 1, -32)
tabList.ZIndex = 3
tabList.Parent = tabBar
Instance.new("UIListLayout", tabList).Padding = UDim.new(0, 3)

-- Content area
local contentArea = Instance.new("Frame")
contentArea.BackgroundColor3 = currentTheme.ContentBg
contentArea.BackgroundTransparency = 0.6
contentArea.BorderSizePixel = 0
contentArea.Position = UDim2.fromOffset(TABBAR_W + 1, TABBAR_Y)
contentArea.Size = UDim2.new(1, -(TABBAR_W + 1), 1, -TABBAR_Y)
contentArea.ClipsDescendants = true
contentArea.ZIndex = 2
contentArea.Parent = root

registerThemeable(function(theme)
    root.BackgroundColor3 = theme.BgBase
    bgGrad.Color = theme.BgGradient
    rootStroke.Color = theme.AccentB
    title.TextColor3 = theme.Text
    subtitle.TextColor3 = theme.TextMute
    closeBtn.TextColor3 = theme.TextDim
    closeBtn.BackgroundColor3 = theme.RowBg
    headerLine.BackgroundColor3 = theme.Divider
    headerGlow.BackgroundColor3 = theme.AccentA
    tabBar.BackgroundColor3 = theme.TabBarBg
    vDiv.BackgroundColor3 = theme.Divider
    contentArea.BackgroundColor3 = theme.ContentBg
end)

-- ═══ TABS ═══
local tabs = {}
local tabOrder = {}
local activeTab = nil

local function createTab(name, displayName)
    local btn = Instance.new("TextButton")
    btn.BackgroundColor3 = currentTheme.RowBg
    btn.BackgroundTransparency = 1
    btn.BorderSizePixel = 0
    btn.Size = UDim2.new(1, 0, 0, 34)
    btn.Text = ""
    btn.AutoButtonColor = false
    btn.ZIndex = 4
    btn.Parent = tabList
    createCorner(btn, 6)

    local indicator = Instance.new("Frame")
    indicator.BackgroundColor3 = currentTheme.AccentB
    indicator.BorderSizePixel = 0
    indicator.Position = UDim2.fromOffset(0, 8)
    indicator.Size = UDim2.new(0, 3, 1, -16)
    indicator.BackgroundTransparency = 1
    indicator.ZIndex = 5
    indicator.Parent = btn
    createCircleCorner(indicator)

    local lbl = Instance.new("TextLabel")
    lbl.BackgroundTransparency = 1
    lbl.Position = UDim2.fromOffset(16, 0)
    lbl.Size = UDim2.new(1, -16, 1, 0)
    lbl.Font = Enum.Font.GothamMedium
    lbl.Text = displayName
    lbl.TextColor3 = currentTheme.TextDim
    lbl.TextSize = 13
    lbl.TextXAlignment = Enum.TextXAlignment.Left
    lbl.ZIndex = 5
    lbl.Parent = btn

    -- ═══ FIX: правильный CanvasSize ═══
    local container = Instance.new("ScrollingFrame")
    container.BackgroundTransparency = 1
    container.BorderSizePixel = 0
    container.Size = UDim2.fromScale(1, 1)
    container.CanvasSize = UDim2.new(1, 0, 0, 0)  -- X = 100% ширины, Y авто
    container.AutomaticCanvasSize = Enum.AutomaticSize.Y
    container.ScrollingDirection = Enum.ScrollingDirection.Y
    container.ScrollBarThickness = 3
    container.ScrollBarImageColor3 = currentTheme.AccentB
    container.ScrollBarImageTransparency = 0.5
    container.Visible = false
    container.ZIndex = 10
    container.Parent = contentArea

    local pad = Instance.new("UIPadding")
    pad.PaddingLeft = UDim.new(0, 20)
    pad.PaddingRight = UDim.new(0, 20)
    pad.PaddingTop = UDim.new(0, 20)
    pad.PaddingBottom = UDim.new(0, 20)
    pad.Parent = container
    Instance.new("UIListLayout", container).Padding = UDim.new(0, 8)

    local tab = { Name=name, Button=btn, Label=lbl, Indicator=indicator, Container=container, Hovered=false }
    tabs[name] = tab
    table.insert(tabOrder, name)

    addConn(btn.MouseEnter:Connect(function()
        tab.Hovered = true
        if activeTab ~= name then
            TweenService:Create(btn, CONFIG.FAST, { BackgroundTransparency = 0.85 }):Play()
            TweenService:Create(lbl, CONFIG.FAST, { TextColor3 = currentTheme.Text }):Play()
        end
    end))
    addConn(btn.MouseLeave:Connect(function()
        tab.Hovered = false
        if activeTab ~= name then
            TweenService:Create(btn, CONFIG.FAST, { BackgroundTransparency = 1 }):Play()
            TweenService:Create(lbl, CONFIG.FAST, { TextColor3 = currentTheme.TextDim }):Play()
        end
    end))
    addConn(btn.MouseButton1Click:Connect(function()
        if activeTab == name then return end
        local prev = activeTab
        activeTab = name
        if prev and tabs[prev] then
            local p = tabs[prev]
            TweenService:Create(p.Button, CONFIG.FAST, { BackgroundTransparency = 1 }):Play()
            p.Label.TextColor3 = currentTheme.TextDim
            TweenService:Create(p.Indicator, CONFIG.FAST, { BackgroundTransparency = 1 }):Play()
            p.Container.Visible = false
        end
        local cur = tabs[name]
        TweenService:Create(cur.Button, CONFIG.FAST, { BackgroundTransparency = 0.85 }):Play()
        cur.Label.TextColor3 = currentTheme.Text
        TweenService:Create(cur.Indicator, CONFIG.FAST, { BackgroundTransparency = 0 }):Play()
        cur.Container.Visible = true
    end))

    registerThemeable(function(theme)
        indicator.BackgroundColor3 = theme.AccentB
        btn.BackgroundColor3 = theme.RowBg
        container.ScrollBarImageColor3 = theme.AccentB
        if activeTab == name then
            lbl.TextColor3 = theme.Text
            indicator.BackgroundTransparency = 0
        elseif tab.Hovered then lbl.TextColor3 = theme.Text
        else lbl.TextColor3 = theme.TextDim end
    end)

    return tab
end

-- ═══ BIND POPUP ═══
local bindPopup = nil
local pendingBindToggle = nil
local function closeBindPopup()
    if bindPopup and bindPopup.Parent then bindPopup:Destroy() end
    bindPopup = nil
    pendingBindToggle = nil
end
local function openBindPopup(toggleObj)
    if pendingBindToggle == toggleObj then closeBindPopup(); return end
    closeBindPopup()
    pendingBindToggle = toggleObj
    local mouse = LocalPlayer:GetMouse()
    local popup = Instance.new("Frame")
    popup.Position = UDim2.fromOffset(mouse.X + 14, mouse.Y + 14)
    popup.Size = UDim2.fromOffset(250, 90)
    popup.BackgroundColor3 = currentTheme.RowBg
    popup.BackgroundTransparency = 0.05
    popup.BorderSizePixel = 0
    popup.ZIndex = 250
    popup.Parent = screenGui
    createCorner(popup, 8)
    local stroke = Instance.new("UIStroke")
    stroke.Color = currentTheme.AccentB
    stroke.Thickness = 1
    stroke.Transparency = 0.3
    stroke.Parent = popup
    local tLbl = Instance.new("TextLabel")
    tLbl.BackgroundTransparency = 1
    tLbl.Position = UDim2.fromOffset(14, 10)
    tLbl.Size = UDim2.new(1, -40, 0, 16)
    tLbl.Font = Enum.Font.GothamBold
    tLbl.Text = "BIND KEY"
    tLbl.TextColor3 = currentTheme.AccentB
    tLbl.TextSize = 10
    tLbl.TextXAlignment = Enum.TextXAlignment.Left
    tLbl.Parent = popup
    local cur = toggleObj.GetBind()
    local subLbl = Instance.new("TextLabel")
    subLbl.BackgroundTransparency = 1
    subLbl.Position = UDim2.fromOffset(14, 32)
    subLbl.Size = UDim2.new(1, -24, 0, 40)
    subLbl.Font = Enum.Font.Gotham
    subLbl.Text = "press any key\ncurrent: " .. (cur and tostring(cur) or "none")
    subLbl.TextColor3 = currentTheme.TextMute
    subLbl.TextSize = 11
    subLbl.TextXAlignment = Enum.TextXAlignment.Left
    subLbl.Parent = popup
    local closeX = Instance.new("TextButton")
    closeX.AnchorPoint = Vector2.new(1, 0)
    closeX.Position = UDim2.new(1, -8, 0, 8)
    closeX.Size = UDim2.fromOffset(18, 18)
    closeX.BackgroundTransparency = 1
    closeX.Text = "✕"
    closeX.TextColor3 = currentTheme.TextDim
    closeX.TextSize = 11
    closeX.Font = Enum.Font.GothamBold
    closeX.AutoButtonColor = false
    closeX.Parent = popup
    addConn(closeX.MouseButton1Click:Connect(closeBindPopup))
    bindPopup = popup
end

-- ═══ UI COMPONENTS ═══
local function createToggle(parent, id, text, default, callback, desc)
    local rowHeight = desc and 54 or 42
    local row = Instance.new("Frame")
    row.BackgroundColor3 = currentTheme.RowBg
    row.BackgroundTransparency = 0.4
    row.BorderSizePixel = 0
    row.Size = UDim2.new(1, 0, 0, rowHeight)
    row.ZIndex = 11
    row.Parent = parent
    createCorner(row, 6)

    local lbl = Instance.new("TextLabel")
    lbl.BackgroundTransparency = 1
    lbl.Position = UDim2.fromOffset(14, desc and 4 or 0)
    lbl.Size = UDim2.new(1, -130, 0, desc and 16 or rowHeight)
    lbl.Font = Enum.Font.GothamMedium
    lbl.Text = text
    lbl.TextColor3 = currentTheme.Text
    lbl.TextSize = 14
    lbl.TextXAlignment = Enum.TextXAlignment.Left
    lbl.ZIndex = 12
    lbl.Parent = row

    local descLbl = nil
    if desc then
        descLbl = Instance.new("TextLabel")
        descLbl.BackgroundTransparency = 1
        descLbl.Position = UDim2.fromOffset(14, 22)
        descLbl.Size = UDim2.new(1, -130, 0, 14)
        descLbl.Font = Enum.Font.Gotham
        descLbl.Text = desc
        descLbl.TextColor3 = currentTheme.TextMute
        descLbl.TextSize = 10
        descLbl.TextXAlignment = Enum.TextXAlignment.Left
        descLbl.TextTruncate = Enum.TextTruncate.AtEnd
        descLbl.ZIndex = 12
        descLbl.Parent = row
        registerThemeable(function(theme) descLbl.TextColor3 = theme.TextMute end)
    end

    local state = default
    if Config.Data.toggles[id] ~= nil then state = Config.Data.toggles[id] end

    local bindKey = nil
    if Config.Data.binds[id] then
        local ok, kc = pcall(function() return Enum.KeyCode[Config.Data.binds[id]] end)
        if ok and kc then bindKey = kc end
    end

    local bindBadge = Instance.new("TextLabel")
    bindBadge.AnchorPoint = Vector2.new(1, 0.5)
    bindBadge.Position = UDim2.new(1, -68, 0.5, 0)
    bindBadge.Size = UDim2.fromOffset(42, 20)
    bindBadge.BackgroundColor3 = currentTheme.RowBg
    bindBadge.BackgroundTransparency = 0.4
    bindBadge.BorderSizePixel = 0
    bindBadge.Font = Enum.Font.GothamBold
    bindBadge.TextSize = 10
    bindBadge.TextColor3 = currentTheme.TextDim
    bindBadge.Visible = bindKey ~= nil
    bindBadge.Text = bindKey and tostring(bindKey) or ""
    bindBadge.ZIndex = 13
    bindBadge.Parent = row
    createCorner(bindBadge, 4)

    local track = Instance.new("Frame")
    track.AnchorPoint = Vector2.new(1, 0.5)
    track.Position = UDim2.new(1, -12, 0.5, 0)
    track.Size = UDim2.fromOffset(46, 24)
    track.BackgroundColor3 = currentTheme.TrackOff
    track.BorderSizePixel = 0
    track.ClipsDescendants = true
    track.ZIndex = 13
    track.Parent = row
    createCircleCorner(track)

    local trackStroke = Instance.new("UIStroke")
    trackStroke.Color = currentTheme.Divider
    trackStroke.Thickness = 1
    trackStroke.Transparency = 0.7
    trackStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
    trackStroke.Parent = track

    local fill = Instance.new("Frame")
    fill.Size = UDim2.fromScale(0, 1)
    fill.BackgroundColor3 = currentTheme.AccentA
    fill.BorderSizePixel = 0
    fill.ZIndex = 14
    fill.Parent = track
    createCircleCorner(fill)

    local fillGrad = Instance.new("UIGradient")
    fillGrad.Color = ColorSequence.new({
        ColorSequenceKeypoint.new(0.0, currentTheme.AccentA),
        ColorSequenceKeypoint.new(1.0, currentTheme.AccentB),
    })
    fillGrad.Parent = fill

    local knob = Instance.new("Frame")
    knob.AnchorPoint = Vector2.new(0.5, 0.5)
    knob.Position = UDim2.new(0, 12, 0.5, 0)
    knob.Size = UDim2.fromOffset(18, 18)
    knob.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
    knob.BorderSizePixel = 0
    knob.ZIndex = 15
    knob.Parent = track
    createCircleCorner(knob)

    local click = Instance.new("TextButton")
    click.BackgroundTransparency = 1
    click.Size = UDim2.fromScale(1, 1)
    click.Text = ""
    click.ZIndex = 16
    click.Parent = row

    local function render()
        TweenService:Create(fill, CONFIG.TOGGLE, { Size = state and UDim2.fromScale(1, 1) or UDim2.fromScale(0, 1) }):Play()
        TweenService:Create(knob, CONFIG.TOGGLE, { Position = state and UDim2.new(1, -12, 0.5, 0) or UDim2.new(0, 12, 0.5, 0) }):Play()
        TweenService:Create(trackStroke, CONFIG.TOGGLE, {
            Transparency = state and 0.15 or 0.7,
            Color = state and currentTheme.AccentB or currentTheme.Divider,
        }):Play()
        TweenService:Create(track, CONFIG.FAST, {
            BackgroundColor3 = state and currentTheme.AccentTrack or currentTheme.TrackOff,
        }):Play()
    end

    local function applyState(newState, notify, fireCb)
        state = newState
        render()
        Config.Data.toggles[id] = state
        saveConfig()
        if fireCb and callback then callback(state) end
        if notify then showNotification(text .. (state and "  ·  enabled" or "  ·  disabled"), state and "on" or "off") end
    end

    local toggleObj = {
        Id = id,
        GetState = function() return state end,
        GetBind  = function() return bindKey end,
        SetState = function(_, newState, notify) applyState(newState, notify ~= false, true) end,
        SetBind  = function(_, keyCode, silent)
            if keyCode then
                for otherId, other in pairs(toggleRegistry) do
                    if otherId ~= id then
                        local ob = other.GetBind()
                        if ob and tostring(ob) == tostring(keyCode) then other.SetBind(nil, true) end
                    end
                end
            end
            bindKey = keyCode
            if keyCode then
                Config.Data.binds[id] = tostring(keyCode)
                bindBadge.Text = tostring(keyCode)
                bindBadge.Visible = true
            else
                Config.Data.binds[id] = nil
                bindBadge.Visible = false
            end
            saveConfig(true)
            if not silent then showNotification(text .. (keyCode and ("  ·  bound:  " .. tostring(keyCode)) or "  ·  unbound")) end
        end,
    }
    toggleRegistry[id] = toggleObj

    addConn(click.MouseButton1Click:Connect(function() applyState(not state, true, true) end))
    addConn(click.MouseButton2Click:Connect(function() openBindPopup(toggleObj) end))

    registerThemeable(function(theme)
        lbl.TextColor3 = theme.Text
        row.BackgroundColor3 = theme.RowBg
        fillGrad.Color = ColorSequence.new({
            ColorSequenceKeypoint.new(0.0, theme.AccentA),
            ColorSequenceKeypoint.new(1.0, theme.AccentB),
        })
        track.BackgroundColor3 = state and theme.AccentTrack or theme.TrackOff
        trackStroke.Color = state and theme.AccentB or theme.Divider
        bindBadge.BackgroundColor3 = theme.RowBg
        bindBadge.TextColor3 = theme.TextDim
    end)

    render()
    if state ~= default then task.defer(function() if callback then callback(state) end end) end
    return toggleObj
end

local function createSlider(parent, id, text, min, max, default, callback, desc)
    local rowHeight = desc and 64 or 48
    local trackY = desc and 44 or 32
    local row = Instance.new("Frame")
    row.BackgroundColor3 = currentTheme.RowBg
    row.BackgroundTransparency = 0.4
    row.BorderSizePixel = 0
    row.Size = UDim2.new(1, 0, 0, rowHeight)
    row.ZIndex = 11
    row.Parent = parent
    createCorner(row, 6)

    local lbl = Instance.new("TextLabel")
    lbl.BackgroundTransparency = 1
    lbl.Position = UDim2.fromOffset(14, 4)
    lbl.Size%2
-- Script provided by RobxScript.com
ADVERTISEMENT
MORE SCRIPTS

Related Scripts

COMMUNITY

Comments

Questions, setup notes and feedback from signed-in RobxScript users.

0
Loading comments...
BROWSE MORE

Browse more Murder Mystery 2

Popular scripts from Murder Mystery 2.

View category
FRESH POSTS

Browse the latest

Recently published Roblox scripts from across RobxScript.