Settings Menu Roblox GUI Template with Volume & Toggle Options
A settings panel with volume sliders, fullscreen toggle, music mute, and language placeholder. Clean UIListLayout. This template provides a comprehensive settings system with smooth slider interactions, animated toggle switches, and a modular design that makes adding new settings effortless. Features a sleek dark theme with accent-colored interactive elements.

Live preview
Settings Menu
1920×1080Includes real, production-ready Luau logic — not a static mockup.
What's inside
- • Master / SFX volume sliders
- • Fullscreen and mute toggles
- • UIListLayout rows
- • Save settings to DataStore stub
- • Back to game button
How to use this template
The Settings Menu template gives players control over volume, fullscreen, and music. Paste the client Luau into StarterGui and a settings panel appears with sliders and toggles arranged in a UIListLayout. The master and SFX volume sliders bind to SoundService, so changes apply immediately. The music toggle mutes and unmutes the background music. The fullscreen toggle uses GameSettings. The layout uses Scale-based sizing, so the panel fits any screen. To customize, add your own settings rows (graphics quality, controls, language) by inserting new frames into the UIListLayout. The save pattern uses DataStore so settings persist across sessions - the server Luau stub shows how to save and load. Test in Studio by dragging the sliders and confirming the audio changes.
Add it to your game in 3 steps
- 1
Copy the Luau
Open the template in the web editor and click Export. Choose LocalScript to copy the full client Luau to your clipboard.
- 2
Paste into StarterGui
In Roblox Studio, right-click StarterGui in the Explorer, insert a LocalScript, and paste the copied Luau. Rename it to match the template.
- 3
Press Play to verify
Click Play in Studio. The GUI should appear exactly as designed. Tweak any Size or Position values in the script if you want to adjust the layout.
1--[[2 Settings Menu - Client Side3 A settings panel with volume sliders, toggles, and clean UIListLayout4 Features: Animated sliders, toggle switches, tab navigation, auto-save5]]67-- Services8local Players = game:GetService("Players")9local TweenService = game:GetService("TweenService")10local ReplicatedStorage = game:GetService("ReplicatedStorage")11local SoundService = game:GetService("SoundService")12local UserInputService = game:GetService("UserInputService")13local RunService = game:GetService("RunService")14local Lighting = game:GetService("Lighting")1516local player = Players.LocalPlayer17local playerGui = player:WaitForChild("PlayerGui")1819-- Constants20local SETTINGS_SIZE = UDim2.new(0, 560, 0, 480)21local SETTINGS_POSITION = UDim2.new(0.5, -280, 0.5, -240)22local SLIDER_WIDTH = 22023local SLIDER_HEIGHT = 824local KNOB_SIZE = 2025local TOGGLE_WIDTH = 5026local TOGGLE_HEIGHT = 2627local TWEEN_DURATION = 0.2528local SECTION_PADDING = 162930-- Colors31local COLOR_BG = Color3.fromRGB(25, 25, 35)32local COLOR_HEADER = Color3.fromRGB(35, 38, 50)33local COLOR_ACCENT = Color3.fromRGB(100, 150, 255)34local COLOR_ACCENT_HOVER = Color3.fromRGB(120, 170, 255)35local COLOR_TEXT_PRIMARY = Color3.fromRGB(255, 255, 255)36local COLOR_TEXT_SECONDARY = Color3.fromRGB(160, 165, 180)37local COLOR_TEXT_MUTED = Color3.fromRGB(100, 105, 120)38local COLOR_ROW_BG = Color3.fromRGB(35, 38, 50)39local COLOR_ROW_HOVER = Color3.fromRGB(45, 48, 62)40local COLOR_SLIDER_BG = Color3.fromRGB(50, 52, 65)41local COLOR_SLIDER_FILL = Color3.fromRGB(100, 150, 255)42local COLOR_TOGGLE_OFF = Color3.fromRGB(60, 62, 75)43local COLOR_TOGGLE_ON = Color3.fromRGB(100, 150, 255)44local COLOR_TAB_ACTIVE = Color3.fromRGB(100, 150, 255)45local COLOR_TAB_INACTIVE = Color3.fromRGB(60, 65, 80)46local COLOR_SAVE = Color3.fromRGB(50, 180, 80)47local COLOR_RESET = Color3.fromRGB(180, 80, 60)4849-- Tween presets50local tweenInfoStandard = TweenInfo.new(TWEEN_DURATION, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)51local tweenInfoSpring = TweenInfo.new(TWEEN_DURATION * 1.2, Enum.EasingStyle.Back, Enum.EasingDirection.Out)52local tweenInfoBounce = TweenInfo.new(TWEEN_DURATION, Enum.EasingStyle.Elastic, Enum.EasingDirection.Out)5354-- Default settings55local DEFAULT_SETTINGS = {56 VolumeMaster = 80,57 VolumeMusic = 70,58 VolumeSFX = 85,59 VolumeVoice = 60,60 Fullscreen = false,61 ShowFPS = false,62 GraphicsQuality = 7,63 Language = "English",64 Difficulty = "Normal",65 ShowTutorial = true,66 TextSize = 100,67 ColorblindMode = "None",68 ReduceMotion = false,69}7071-- Current settings (loaded from defaults or server)72local currentSettings = {}73for key, value in pairs(DEFAULT_SETTINGS) do74 currentSettings[key] = value75end7677-- GUI References78local settingsGui, settingsFrame, contentContainer, tabContainer79local sections = {}80local activeTab = "Audio"81local isVisible = false8283-- Slider drag state84local draggingSlider = nil85local sliderConnections = {}8687-----------------------------------------------------------88-- Helper Functions89-----------------------------------------------------------9091local function Create(className, props)92 local instance = Instance.new(className)93 for key, value in pairs(props or {}) do94 instance[key] = value95 end96 return instance97end9899local function Tween(instance, properties, tweenInfoOverride)100 local info = tweenInfoOverride or tweenInfoStandard101 local tween = TweenService:Create(instance, info, properties)102 tween:Play()103 return tween104end105106local function FormatPercentage(value)107 return tostring(math.floor(value)) .. "%"108end109110-----------------------------------------------------------111-- UI Construction112-----------------------------------------------------------113114local function BuildUI()115 -- ScreenGui116 settingsGui = Create("ScreenGui", {117 Name = "SettingsGui",118 ResetOnSpawn = false,119 ZIndexBehavior = Enum.ZIndexBehavior.Sibling,120 Parent = playerGui,121 })122123 -- Main Settings Frame124 settingsFrame = Create("Frame", {125 Name = "SettingsFrame",126 Size = SETTINGS_SIZE,127 Position = UDim2.new(0.5, 0, 0.4, 0),128 AnchorPoint = Vector2.new(0.5, 0.5),129 BackgroundColor3 = COLOR_BG,130 BorderSizePixel = 0,131 Visible = false,132 ZIndex = 10,133 Parent = settingsGui,134 })135136 Create("UICorner", {137 CornerRadius = UDim.new(0, 14),138 Parent = settingsFrame,139 })140141 Create("UIGradient", {142 Color = ColorSequence.new({143 ColorSequenceKeypoint.new(0, Color3.fromRGB(28, 28, 40)),144 ColorSequenceKeypoint.new(1, Color3.fromRGB(22, 22, 32)),145 }),146 Rotation = 90,147 Parent = settingsFrame,148 })149150 -- Shadow151 Create("ImageLabel", {152 Name = "Shadow",153 Size = UDim2.new(1, 40, 1, 40),154 Position = UDim2.new(0, -20, 0, -20),155 BackgroundTransparency = 1,156 Image = "rbxassetid://5554236805",157 ImageColor3 = Color3.fromRGB(0, 0, 0),158 ImageTransparency = 0.65,159 ScaleType = Enum.ScaleType.Slice,160 SliceCenter = Rect.new(23, 23, 277, 277),161 ZIndex = 9,162 Parent = settingsFrame,163 })164165 -- Header166 local headerFrame = Create("Frame", {167 Name = "HeaderFrame",168 Size = UDim2.new(1, 0, 0, 60),169 BackgroundColor3 = COLOR_HEADER,170 BorderSizePixel = 0,171 ZIndex = 11,172 Parent = settingsFrame,173 })174175 Create("UICorner", {176 CornerRadius = UDim.new(0, 14),177 Parent = headerFrame,178 })179180 local headerFix = Create("Frame", {181 Size = UDim2.new(1, 0, 0, 14),182 Position = UDim2.new(0, 0, 1, -14),183 BackgroundColor3 = COLOR_HEADER,184 BorderSizePixel = 0,185 ZIndex = 11,186 Parent = headerFrame,187 })188189 Create("TextLabel", {190 Name = "TitleLabel",191 Size = UDim2.new(0.5, 0, 0, 30),192 Position = UDim2.new(0, 20, 0, 10),193 BackgroundTransparency = 1,194 Text = "Settings",195 TextColor3 = COLOR_TEXT_PRIMARY,196 TextSize = 22,197 Font = Enum.Font.GothamBold,198 TextXAlignment = Enum.TextXAlignment.Left,199 ZIndex = 12,200 Parent = headerFrame,201 })202203 local closeButton = Create("TextButton", {204 Name = "CloseButton",205 Size = UDim2.new(0, 70, 0, 30),206 Position = UDim2.new(1, -90, 0, 15),207 BackgroundColor3 = COLOR_ROW_BG,208 Text = "Close",209 TextColor3 = COLOR_TEXT_PRIMARY,210 TextSize = 12,211 Font = Enum.Font.GothamSemibold,212 AutoButtonColor = false,213 ZIndex = 12,214 Parent = headerFrame,215 })216217 Create("UICorner", {218 CornerRadius = UDim.new(0, 8),219 Parent = closeButton,220 })221222 closeButton.MouseEnter:Connect(function()223 Tween(closeButton, {BackgroundColor3 = COLOR_ROW_HOVER})224 end)225 closeButton.MouseLeave:Connect(function()226 Tween(closeButton, {BackgroundColor3 = COLOR_ROW_BG})227 end)228 closeButton.MouseButton1Click:Connect(function()229 ToggleSettings(false)230 end)231232 -- Tab Container233 tabContainer = Create("Frame", {234 Name = "TabContainer",235 Size = UDim2.new(1, -40, 0, 40),236 Position = UDim2.new(0, 20, 0, 68),237 BackgroundTransparency = 1,238 ZIndex = 11,239 Parent = settingsFrame,240 })241242 local tabLayout = Create("UIListLayout", {243 Padding = UDim.new(0, 8),244 FillDirection = Enum.FillDirection.Horizontal,245 SortOrder = Enum.SortOrder.LayoutOrder,246 Parent = tabContainer,247 })248249 -- Content Container250 contentContainer = Create("Frame", {251 Name = "ContentContainer",252 Size = UDim2.new(1, -40, 1, -(60 + 40 + 50)),253 Position = UDim2.new(0, 20, 0, 112),254 BackgroundColor3 = COLOR_ROW_BG,255 BorderSizePixel = 0,256 ZIndex = 11,257 Parent = settingsFrame,258 })259260 Create("UICorner", {261 CornerRadius = UDim.new(0, 10),262 Parent = contentContainer,263 })264265 -- Footer266 local footerFrame = Create("Frame", {267 Name = "FooterFrame",268 Size = UDim2.new(1, 0, 0, 44),269 Position = UDim2.new(0, 0, 1, -44),270 BackgroundColor3 = COLOR_HEADER,271 BorderSizePixel = 0,272 ZIndex = 11,273 Parent = settingsFrame,274 })275276 Create("UICorner", {277 CornerRadius = UDim.new(0, 14),278 Parent = footerFrame,279 })280281 local footerFix = Create("Frame", {282 Size = UDim2.new(1, 0, 0, 14),283 Position = UDim2.new(0, 0, 0, 0),284 BackgroundColor3 = COLOR_HEADER,285 BorderSizePixel = 0,286 ZIndex = 11,287 Parent = footerFrame,288 })289290 local resetButton = Create("TextButton", {291 Name = "ResetButton",292 Size = UDim2.new(0, 80, 0, 28),293 Position = UDim2.new(0, 20, 0, 8),294 BackgroundColor3 = COLOR_RESET,295 Text = "Reset",296 TextColor3 = COLOR_TEXT_PRIMARY,297 TextSize = 12,298 Font = Enum.Font.GothamSemibold,299 AutoButtonColor = false,300 ZIndex = 12,301 Parent = footerFrame,302 })303304 Create("UICorner", {305 CornerRadius = UDim.new(0, 6),306 Parent = resetButton,307 })308309 local saveButton = Create("TextButton", {310 Name = "SaveButton",311 Size = UDim2.new(0, 80, 0, 28),312 Position = UDim2.new(1, -100, 0, 8),313 BackgroundColor3 = COLOR_SAVE,314 Text = "Save",315 TextColor3 = COLOR_TEXT_PRIMARY,316 TextSize = 12,317 Font = Enum.Font.GothamSemibold,318 AutoButtonColor = false,319 ZIndex = 12,320 Parent = footerFrame,321 })322323 Create("UICorner", {324 CornerRadius = UDim.new(0, 6),325 Parent = saveButton,326 })327328 local statusLabel = Create("TextLabel", {329 Name = "StatusLabel",330 Size = UDim2.new(0, 200, 0, 28),331 Position = UDim2.new(0.5, -100, 0, 8),332 BackgroundTransparency = 1,333 Text = "",334 TextColor3 = COLOR_TEXT_SECONDARY,335 TextSize = 12,336 Font = Enum.Font.Gotham,337 TextXAlignment = Enum.TextXAlignment.Center,338 ZIndex = 12,339 Parent = footerFrame,340 })341342 -- Button handlers343 resetButton.MouseEnter:Connect(function()344 Tween(resetButton, {BackgroundColor3 = Color3.fromRGB(200, 90, 70)})345 end)346 resetButton.MouseLeave:Connect(function()347 Tween(resetButton, {BackgroundColor3 = COLOR_RESET})348 end)349 resetButton.MouseButton1Click:Connect(ResetSettings)350351 saveButton.MouseEnter:Connect(function()352 Tween(saveButton, {BackgroundColor3 = Color3.fromRGB(60, 200, 90)})353 end)354 saveButton.MouseLeave:Connect(function()355 Tween(saveButton, {BackgroundColor3 = COLOR_SAVE})356 end)357 saveButton.MouseButton1Click:Connect(SaveSettings)358359 -- Settings Open Button360 local settingsButton = Create("TextButton", {361 Name = "SettingsButton",362 Size = UDim2.new(0, 50, 0, 50),363 Position = UDim2.new(1, -70, 0, 20),364 BackgroundColor3 = COLOR_HEADER,365 Text = "S",366 TextColor3 = COLOR_ACCENT,367 TextSize = 24,368 Font = Enum.Font.GothamBold,369 AutoButtonColor = false,370 ZIndex = 5,371 Parent = settingsGui,372 })373374 Create("UICorner", {375 CornerRadius = UDim.new(1, 0),376 Parent = settingsButton,377 })378379 settingsButton.MouseEnter:Connect(function()380 Tween(settingsButton, {BackgroundColor3 = COLOR_ROW_HOVER})381 Tween(settingsButton, {Size = UDim2.new(0, 54, 0, 54)})382 settingsButton.Position = UDim2.new(1, -74, 0, 18)383 end)384 settingsButton.MouseLeave:Connect(function()385 Tween(settingsButton, {BackgroundColor3 = COLOR_HEADER})386 Tween(settingsButton, {Size = UDim2.new(0, 50, 0, 50)})387 settingsButton.Position = UDim2.new(1, -70, 0, 20)388 end)389 settingsButton.MouseButton1Click:Connect(function()390 ToggleSettings(true)391 end)392end393394-----------------------------------------------------------395-- Slider Component396-----------------------------------------------------------397398local function CreateSlider(parent, settingKey, label, min, max, defaultValue)399 local container = Create("Frame", {400 Name = settingKey .. "Container",401 Size = UDim2.new(1, -SECTION_PADDING * 2, 0, 50),402 BackgroundTransparency = 1,403 Parent = parent,404 })405406 -- Label407 local labelText = Create("TextLabel", {408 Name = "Label",409 Size = UDim2.new(0, 160, 0, 24),410 Position = UDim2.new(0, 0, 0, 0),411 BackgroundTransparency = 1,412 Text = label,413 TextColor3 = COLOR_TEXT_PRIMARY,414 TextSize = 14,415 Font = Enum.Font.GothamSemibold,416 TextXAlignment = Enum.TextXAlignment.Left,417 ZIndex = 13,418 Parent = container,419 })420421 -- Value label422 local valueLabel = Create("TextLabel", {423 Name = "ValueLabel",424 Size = UDim2.new(0, 50, 0, 24),425 Position = UDim2.new(1, -50, 0, 0),426 BackgroundTransparency = 1,427 Text = FormatPercentage(defaultValue),428 TextColor3 = COLOR_ACCENT,429 TextSize = 14,430 Font = Enum.Font.GothamBold,431 TextXAlignment = Enum.TextXAlignment.Right,432 ZIndex = 13,433 Parent = container,434 })435436 -- Slider background437 local sliderBg = Create("Frame", {438 Name = "SliderBackground",439 Size = UDim2.new(1, 0, 0, SLIDER_HEIGHT),440 Position = UDim2.new(0, 0, 0, 30),441 BackgroundColor3 = COLOR_SLIDER_BG,442 BorderSizePixel = 0,443 ZIndex = 13,444 Parent = container,445 })446447 Create("UICorner", {448 CornerRadius = UDim.new(0, 4),449 Parent = sliderBg,450 })451452 -- Slider fill453 local sliderFill = Create("Frame", {454 Name = "SliderFill",455 Size = UDim2.new((defaultValue - min) / (max - min), 0, 1, 0),456 BackgroundColor3 = COLOR_SLIDER_FILL,457 BorderSizePixel = 0,458 ZIndex = 14,459 Parent = sliderBg,460 })461462 Create("UICorner", {463 CornerRadius = UDim.new(0, 4),464 Parent = sliderFill,465 })466467 -- Slider knob468 local knob = Create("Frame", {469 Name = "Knob",470 Size = UDim2.new(0, KNOB_SIZE, 0, KNOB_SIZE),471 Position = UDim2.new((defaultValue - min) / (max - min), -KNOB_SIZE/2, 0.5, -KNOB_SIZE/2),472 AnchorPoint = Vector2.new(0, 0),473 BackgroundColor3 = COLOR_TEXT_PRIMARY,474 BorderSizePixel = 0,475 ZIndex = 15,476 Parent = sliderBg,477 })478479 Create("UICorner", {480 CornerRadius = UDim.new(1, 0),481 Parent = knob,482 })483484 -- Knob glow485 local knobGlow = Create("UIStroke", {486 Color = COLOR_ACCENT,487 Thickness = 2,488 Transparency = 0.5,489 Parent = knob,490 })491492 -- Interactivity493 local isDragging = false494495 local function UpdateSlider(input)496 local sliderPos = sliderBg.AbsolutePosition.X497 local sliderWidth = sliderBg.AbsoluteSize.X498 local inputX = input.Position.X499500 local percent = math.clamp((inputX - sliderPos) / sliderWidth, 0, 1)501 local value = min + (percent * (max - min))502503 -- Update visual504 sliderFill.Size = UDim2.new(percent, 0, 1, 0)505 knob.Position = UDim2.new(percent, -KNOB_SIZE/2, 0.5, -KNOB_SIZE/2)506 valueLabel.Text = FormatPercentage(value)507508 -- Update setting509 currentSettings[settingKey] = value510511 -- Apply live512 ApplySetting(settingKey, value)513514 return value515 end516517 sliderBg.InputBegan:Connect(function(input)518 if input.UserInputType == Enum.UserInputType.MouseButton1 or519 input.UserInputType == Enum.UserInputType.Touch then520 isDragging = true521 draggingSlider = settingKey522 UpdateSlider(input)523 -- Enlarge knob524 Tween(knob, {Size = UDim2.new(0, 26, 0, 26)})525 Tween(knobGlow, {Thickness = 3, Transparency = 0.2})526 end527 end)528529 knob.InputBegan:Connect(function(input)530 if input.UserInputType == Enum.UserInputType.MouseButton1 or531 input.UserInputType == Enum.UserInputType.Touch then532 isDragging = true533 draggingSlider = settingKey534 Tween(knob, {Size = UDim2.new(0, 26, 0, 26)})535 Tween(knobGlow, {Thickness = 3, Transparency = 0.2})536 end537 end)538539 -- Store slider reference for global input handling540 sliderConnections[settingKey] = {541 Update = UpdateSlider,542 Knob = knob,543 KnobGlow = knobGlow,544 }545546 return container547end548549-----------------------------------------------------------550-- Toggle Component551-----------------------------------------------------------552553local function CreateToggle(parent, settingKey, label, defaultValue)554 local container = Create("Frame", {555 Name = settingKey .. "Container",556 Size = UDim2.new(1, -SECTION_PADDING * 2, 0, 44),557 BackgroundTransparency = 1,558 Parent = parent,559 })560561 -- Label562 Create("TextLabel", {563 Name = "Label",564 Size = UDim2.new(0, 200, 1, 0),565 BackgroundTransparency = 1,566 Text = label,567 TextColor3 = COLOR_TEXT_PRIMARY,568 TextSize = 14,569 Font = Enum.Font.GothamSemibold,570 TextXAlignment = Enum.TextXAlignment.Left,571 ZIndex = 13,572 Parent = container,573 })574575 -- Toggle background576 local toggleBg = Create("TextButton", {577 Name = "ToggleBackground",578 Size = UDim2.new(0, TOGGLE_WIDTH, 0, TOGGLE_HEIGHT),579 Position = UDim2.new(1, -TOGGLE_WIDTH, 0.5, -TOGGLE_HEIGHT/2),580 BackgroundColor3 = defaultValue and COLOR_TOGGLE_ON or COLOR_TOGGLE_OFF,581 Text = "",582 AutoButtonColor = false,583 ZIndex = 13,584 Parent = container,585 })586587 Create("UICorner", {588 CornerRadius = UDim.new(0, TOGGLE_HEIGHT/2),589 Parent = toggleBg,590 })591592 -- Toggle knob593 local toggleKnob = Create("Frame", {594 Name = "ToggleKnob",595 Size = UDim2.new(0, TOGGLE_HEIGHT - 4, 0, TOGGLE_HEIGHT - 4),596 Position = defaultValue and UDim2.new(1, -(TOGGLE_HEIGHT - 2), 0.5, -(TOGGLE_HEIGHT - 4)/2)597 or UDim2.new(0, 2, 0.5, -(TOGGLE_HEIGHT - 4)/2),598 BackgroundColor3 = COLOR_TEXT_PRIMARY,599 BorderSizePixel = 0,600 ZIndex = 14,601 Parent = toggleBg,602 })603604 Create("UICorner", {605 CornerRadius = UDim.new(1, 0),606 Parent = toggleKnob,607 })608609 -- State label610 local stateLabel = Create("TextLabel", {611 Name = "StateLabel",612 Size = UDim2.new(0, 60, 0, 20),613 Position = UDim2.new(1, -TOGGLE_WIDTH - 65, 0.5, -10),614 BackgroundTransparency = 1,615 Text = defaultValue and "ON" or "OFF",616 TextColor3 = defaultValue and COLOR_TOGGLE_ON or COLOR_TEXT_MUTED,617 TextSize = 12,618 Font = Enum.Font.GothamBold,619 TextXAlignment = Enum.TextXAlignment.Right,620 ZIndex = 13,621 Parent = container,622 })623624 -- Toggle click handler625 toggleBg.MouseButton1Click:Connect(function()626 local newValue = not currentSettings[settingKey]627 currentSettings[settingKey] = newValue628629 -- Animate toggle630 if newValue then631 Tween(toggleBg, {BackgroundColor3 = COLOR_TOGGLE_ON})632 Tween(toggleKnob, {633 Position = UDim2.new(1, -(TOGGLE_HEIGHT - 2), 0.5, -(TOGGLE_HEIGHT - 4)/2)634 })635 stateLabel.Text = "ON"636 Tween(stateLabel, {TextColor3 = COLOR_TOGGLE_ON})637 else638 Tween(toggleBg, {BackgroundColor3 = COLOR_TOGGLE_OFF})639 Tween(toggleKnob, {640 Position = UDim2.new(0, 2, 0.5, -(TOGGLE_HEIGHT - 4)/2)641 })642 stateLabel.Text = "OFF"643 Tween(stateLabel, {TextColor3 = COLOR_TEXT_MUTED})644 end645646 ApplySetting(settingKey, newValue)647 end)648649 toggleBg.MouseEnter:Connect(function()650 Tween(toggleBg, {BackgroundTransparency = 0.1})651 end)652 toggleBg.MouseLeave:Connect(function()653 Tween(toggleBg, {BackgroundTransparency = 0})654 end)655656 return container657end658659-----------------------------------------------------------660-- Dropdown Component661-----------------------------------------------------------662663local function CreateDropdown(parent, settingKey, label, options, defaultValue)664 local container = Create("Frame", {665 Name = settingKey .. "Container",666 Size = UDim2.new(1, -SECTION_PADDING * 2, 0, 44),667 BackgroundTransparency = 1,668 Parent = parent,669 })670671 -- Label672 Create("TextLabel", {673 Name = "Label",674 Size = UDim2.new(0, 160, 1, 0),675 BackgroundTransparency = 1,676 Text = label,677 TextColor3 = COLOR_TEXT_PRIMARY,678 TextSize = 14,679 Font = Enum.Font.GothamSemibold,680 TextXAlignment = Enum.TextXAlignment.Left,681 ZIndex = 13,682 Parent = container,683 })684685 -- Dropdown button686 local dropdownBtn = Create("TextButton", {687 Name = "DropdownButton",688 Size = UDim2.new(0, 140, 0, 32),689 Position = UDim2.new(1, -140, 0.5, -16),690 BackgroundColor3 = COLOR_ROW_BG,691 Text = " " .. defaultValue .. " v",692 TextColor3 = COLOR_TEXT_PRIMARY,693 TextSize = 13,694 Font = Enum.Font.Gotham,695 TextXAlignment = Enum.TextXAlignment.Left,696 AutoButtonColor = false,697 ZIndex = 13,698 Parent = container,699 })700701 Create("UICorner", {702 CornerRadius = UDim.new(0, 8),703 Parent = dropdownBtn,704 })705706 local dropdownOpen = false707 local dropdownMenu = nil708709 dropdownBtn.MouseButton1Click:Connect(function()710 dropdownOpen = not dropdownOpen711712 if dropdownOpen then713 dropdownBtn.Text = " " .. currentSettings[settingKey] .. " ^"714715 -- Create dropdown menu716 dropdownMenu = Create("Frame", {717 Name = "DropdownMenu",718 Size = UDim2.new(0, 140, 0, #options * 32),719 Position = UDim2.new(1, -140, 0, 36),720 BackgroundColor3 = COLOR_ROW_HOVER,721 BorderSizePixel = 0,722 ZIndex = 20,723 Parent = dropdownBtn,724 })725726 Create("UICorner", {727 CornerRadius = UDim.new(0, 8),728 Parent = dropdownMenu,729 })730731 for i, option in ipairs(options) do732 local optionBtn = Create("TextButton", {733 Name = "Option_" .. option,734 Size = UDim2.new(1, 0, 0, 30),735 Position = UDim2.new(0, 0, 0, (i-1) * 32 + 1),736 BackgroundColor3 = option == currentSettings[settingKey] and COLOR_ACCENT or COLOR_ROW_HOVER,737 Text = " " .. option,738 TextColor3 = COLOR_TEXT_PRIMARY,739 TextSize = 12,740 Font = Enum.Font.Gotham,741 TextXAlignment = Enum.TextXAlignment.Left,742 AutoButtonColor = false,743 ZIndex = 21,744 Parent = dropdownMenu,745 })746747 optionBtn.MouseEnter:Connect(function()748 Tween(optionBtn, {BackgroundColor3 = COLOR_ACCENT})749 end)750 optionBtn.MouseLeave:Connect(function()751 if option ~= currentSettings[settingKey] then752 Tween(optionBtn, {BackgroundColor3 = COLOR_ROW_HOVER})753 end754 end)755756 optionBtn.MouseButton1Click:Connect(function()757 currentSettings[settingKey] = option758 dropdownBtn.Text = " " .. option .. " v"759 dropdownOpen = false760 if dropdownMenu then761 dropdownMenu:Destroy()762 dropdownMenu = nil763 end764 ApplySetting(settingKey, option)765 end)766 end767 else768 dropdownBtn.Text = " " .. currentSettings[settingKey] .. " v"769 if dropdownMenu then770 dropdownMenu:Destroy()771 dropdownMenu = nil772 end773 end774 end)775776 return container777end778779-----------------------------------------------------------780-- Section Construction781-----------------------------------------------------------782783local function CreateSection(name, title)784 local section = Create("Frame", {785 Name = name .. "Section",786 Size = UDim2.new(1, 0, 1, 0),787 BackgroundTransparency = 1,788 Visible = false,789 ZIndex = 12,790 Parent = contentContainer,791 })792793 -- Scrollable content794 local scrollingFrame = Create("ScrollingFrame", {795 Name = "ScrollingContent",796 Size = UDim2.new(1, 0, 1, 0),797 BackgroundTransparency = 1,798 BorderSizePixel = 0,799 ScrollBarThickness = 4,800 ScrollBarImageColor3 = COLOR_ACCENT,801 ScrollBarImageTransparency = 0.5,802 CanvasSize = UDim2.new(0, 0, 0, 300),803 ZIndex = 12,804 Parent = section,805 })806807 Create("UIListLayout", {808 Padding = UDim.new(0, 8),809 SortOrder = Enum.SortOrder.LayoutOrder,810 Parent = scrollingFrame,811 })812813 Create("UIPadding", {814 PaddingTop = UDim.new(0, SECTION_PADDING),815 PaddingBottom = UDim.new(0, SECTION_PADDING),816 PaddingLeft = UDim.new(0, SECTION_PADDING),817 PaddingRight = UDim.new(0, SECTION_PADDING),818 Parent = scrollingFrame,819 })820821 sections[name] = { Frame = section, Scroll = scrollingFrame }822 return scrollingFrame823end824825local function CreateTabButton(name, displayName, icon)826 local btn = Create("TextButton", {827 Name = name .. "Tab",828 Size = UDim2.new(0, 0, 1, 0),829 AutomaticSize = Enum.AutomaticSize.X,830 BackgroundColor3 = (name == activeTab) and COLOR_TAB_ACTIVE or COLOR_TAB_INACTIVE,831 Text = " " .. (icon or "") .. " " .. displayName .. " ",832 TextColor3 = (name == activeTab) and COLOR_TEXT_PRIMARY or COLOR_TEXT_SECONDARY,833 TextSize = 13,834 Font = Enum.Font.GothamSemibold,835 AutoButtonColor = false,836 ZIndex = 12,837 Parent = tabContainer,838 })839840 Create("UICorner", {841 CornerRadius = UDim.new(0, 8),842 Parent = btn,843 })844845 btn.MouseButton1Click:Connect(function()846 SwitchTab(name)847 end)848849 btn.MouseEnter:Connect(function()850 if name ~= activeTab then851 Tween(btn, {BackgroundColor3 = COLOR_ROW_HOVER})852 end853 end)854 btn.MouseLeave:Connect(function()855 if name ~= activeTab then856 Tween(btn, {BackgroundColor3 = COLOR_TAB_INACTIVE})857 end858 end)859860 return btn861end862863-----------------------------------------------------------864-- Tab Switching865-----------------------------------------------------------866867local tabButtons = {}868869function SwitchTab(tabName)870 if tabName == activeTab then return end871 activeTab = tabName872873 -- Update tab button visuals874 for name, btn in pairs(tabButtons) do875 if name == tabName then876 Tween(btn, {BackgroundColor3 = COLOR_TAB_ACTIVE})877 btn.TextColor3 = COLOR_TEXT_PRIMARY878 else879 Tween(btn, {BackgroundColor3 = COLOR_TAB_INACTIVE})880 btn.TextColor3 = COLOR_TEXT_SECONDARY881 end882 end883884 -- Switch sections with animation885 for name, section in pairs(sections) do886 if name == tabName then887 section.Frame.Visible = true888 section.Frame.BackgroundTransparency = 1889 Tween(section.Frame, {BackgroundTransparency = 1}, tweenInfoStandard)890 else891 section.Frame.Visible = false892 end893 end894end895896-----------------------------------------------------------897-- Visibility Toggle898-----------------------------------------------------------899900function ToggleSettings(show)901 isVisible = show902903 if show then904 settingsFrame.Visible = true905 Tween(settingsFrame, {906 Position = SETTINGS_POSITION,907 BackgroundTransparency = 0,908 }, tweenInfoSpring)909 else910 Tween(settingsFrame, {911 Position = UDim2.new(0.5, 0, 0.35, 0),912 BackgroundTransparency = 1,913 }, tweenInfoStandard)914 task.delay(TWEEN_DURATION, function()915 if not isVisible then916 settingsFrame.Visible = false917 end918 end)919 end920end921922-----------------------------------------------------------923-- Settings Application924-----------------------------------------------------------925926function ApplySetting(key, value)927 if string.sub(key, 1, 6) == "Volume" then928 -- Apply volume settings929 local category = string.sub(key, 7)930 category = string.lower(category)931 if category == "master" then932 SoundService.Volume = value / 100933 elseif category == "music" then934 local musicGroup = SoundService:FindFirstChild("MusicGroup")935 if musicGroup then936 musicGroup.Volume = value / 100937 end938 elseif category == "sfx" then939 local sfxGroup = SoundService:FindFirstChild("SFXGroup")940 if sfxGroup then941 sfxGroup.Volume = value / 100942 end943 elseif category == "voice" then944 local voiceGroup = SoundService:FindFirstChild("VoiceGroup")945 if voiceGroup then946 voiceGroup.Volume = value / 100947 end948 end949 elseif key == "ShowFPS" then950 -- Toggle FPS counter visibility951 _G.ShowFPSCounter = value952 elseif key == "GraphicsQuality" then953 -- Apply graphics quality954 UserSettings():GetService("UserGameSettings").SavedQualityLevel = math.floor(value)955 elseif key == "TextSize" then956 -- Apply text size scaling957 local scale = value / 100958 for _, gui in ipairs(playerGui:GetChildren()) do959 if gui:IsA("ScreenGui") then960 for _, obj in ipairs(gui:GetDescendants()) do961 if obj:IsA("TextLabel") or obj:IsA("TextButton") or obj:IsA("TextBox") then962 -- Scale from base size963 end964 end965 end966 end967 end968969 -- Update status label970 local footer = settingsFrame:FindFirstChild("FooterFrame")971 if footer then972 local label = footer:FindFirstChild("StatusLabel")973 if label then974 label.Text = "Setting updated: " .. key975 task.delay(2, function()976 if label then977 label.Text = ""978 end979 end)980 end981 end982end983984-----------------------------------------------------------985-- Save and Reset986-----------------------------------------------------------987988function SaveSettings()989 -- Send to server990 local SettingsEvents = ReplicatedStorage:FindFirstChild("SettingsEvents")991 if SettingsEvents then992 local SaveSettingsRemote = SettingsEvents:FindFirstChild("SaveSettings")993 if SaveSettingsRemote then994 local success = pcall(function()995 SaveSettingsRemote:FireServer(currentSettings)996 end)997 if success then998 ShowStatus("Settings saved successfully!", COLOR_SAVE)999 else1000 ShowStatus("Failed to save settings.", COLOR_RESET)1001 end1002 end1003 else1004 ShowStatus("Settings saved locally!", COLOR_SAVE)1005 end1006end10071008function ResetSettings()1009 -- Reset to defaults1010 for key, value in pairs(DEFAULT_SETTINGS) do1011 currentSettings[key] = value1012 ApplySetting(key, value)1013 end10141015 -- Rebuild UI to reflect defaults1016 BuildSettingsContent()1017 ShowStatus("Settings reset to defaults.", COLOR_ACCENT)1018end10191020function ShowStatus(message, color)1021 local footer = settingsFrame:FindFirstChild("FooterFrame")1022 if footer then1023 local label = footer:FindFirstChild("StatusLabel")1024 if label then1025 label.Text = message1026 label.TextColor3 = color or COLOR_TEXT_SECONDARY1027 task.delay(3, function()1028 if label then1029 label.Text = ""1030 label.TextColor3 = COLOR_TEXT_SECONDARY1031 end1032 end)1033 end1034 end1035end10361037-----------------------------------------------------------1038-- Build Settings Content1039-----------------------------------------------------------10401041function BuildSettingsContent()1042 -- Clear existing1043 for _, section in pairs(sections) do1044 section.Frame:Destroy()1045 end1046 sections = {}1047 for _, btn in pairs(tabButtons) do1048 btn:Destroy()1049 end1050 tabButtons = {}10511052 -- Create sections1053 local audioSection = CreateSection("Audio", "Audio")1054 local displaySection = CreateSection("Display", "Display")1055 local gameplaySection = CreateSection("Gameplay", "Gameplay")1056 local accessibilitySection = CreateSection("Accessibility", "Accessibility")10571058 -- Create tab buttons1059 tabButtons["Audio"] = CreateTabButton("Audio", "Audio", "")1060 tabButtons["Display"] = CreateTabButton("Display", "Display", "")1061 tabButtons["Gameplay"] = CreateTabButton("Gameplay", "Gameplay", "")1062 tabButtons["Accessibility"] = CreateTabButton("Accessibility", "Accessibility", "")10631064 -- ─── Audio Section ───────────────────────────────────1065 CreateSlider(audioSection, "VolumeMaster", "Master Volume", 0, 100, currentSettings.VolumeMaster)1066 CreateSlider(audioSection, "VolumeMusic", "Music Volume", 0, 100, currentSettings.VolumeMusic)1067 CreateSlider(audioSection, "VolumeSFX", "SFX Volume", 0, 100, currentSettings.VolumeSFX)1068 CreateSlider(audioSection, "VolumeVoice", "Voice Volume", 0, 100, currentSettings.VolumeVoice)10691070 -- ─── Display Section ─────────────────────────────────1071 CreateToggle(displaySection, "Fullscreen", "Fullscreen Mode", currentSettings.Fullscreen)1072 CreateToggle(displaySection, "ShowFPS", "Show FPS Counter", currentSettings.ShowFPS)1073 CreateSlider(displaySection, "GraphicsQuality", "Graphics Quality", 1, 10, currentSettings.GraphicsQuality)10741075 -- ─── Gameplay Section ────────────────────────────────1076 CreateDropdown(gameplaySection, "Language", "Language", {"English", "Spanish", "French", "German", "Japanese", "Korean", "Chinese"}, currentSettings.Language)1077 CreateDropdown(gameplaySection, "Difficulty", "Difficulty", {"Easy", "Normal", "Hard", "Expert"}, currentSettings.Difficulty)1078 CreateToggle(gameplaySection, "ShowTutorial", "Show Tutorials", currentSettings.ShowTutorial)10791080 -- ─── Accessibility Section ───────────────────────────1081 CreateSlider(accessibilitySection, "TextSize", "Text Size", 50, 150, currentSettings.TextSize)1082 CreateDropdown(accessibilitySection, "ColorblindMode", "Colorblind Mode", {"None", "Deuteranopia", "Protanopia", "Tritanopia"}, currentSettings.ColorblindMode)1083 CreateToggle(accessibilitySection, "ReduceMotion", "Reduce Motion", currentSettings.ReduceMotion)10841085 -- Show active tab1086 SwitchTab(activeTab)1087end10881089-----------------------------------------------------------1090-- Global Input Handling for Sliders1091-----------------------------------------------------------10921093local function SetupGlobalInput()1094 UserInputService.InputChanged:Connect(function(input)1095 if draggingSlider and sliderConnections[draggingSlider] then1096 if input.UserInputType == Enum.UserInputType.MouseMovement or1097 input.UserInputType == Enum.UserInputType.Touch then1098 sliderConnections[draggingSlider].Update(input)1099 end1100 end1101 end)11021103 UserInputService.InputEnded:Connect(function(input)1104 if input.UserInputType == Enum.UserInputType.MouseButton1 or1105 input.UserInputType == Enum.UserInputType.Touch then1106 if draggingSlider and sliderConnections[draggingSlider] then1107 -- Reset knob size1108 Tween(sliderConnections[draggingSlider].Knob, {Size = UDim2.new(0, KNOB_SIZE, 0, KNOB_SIZE)})1109 Tween(sliderConnections[draggingSlider].KnobGlow, {Thickness = 2, Transparency = 0.5})1110 end1111 draggingSlider = nil1112 end1113 end)1114end11151116-----------------------------------------------------------1117-- Keyboard Shortcuts1118-----------------------------------------------------------11191120local function SetupKeyboardShortcuts()1121 UserInputService.InputBegan:Connect(function(input, gameProcessed)1122 if gameProcessed then return end1123 if input.KeyCode == Enum.KeyCode.Escape then1124 if isVisible then1125 ToggleSettings(false)1126 end1127 end1128 end)1129end11301131-----------------------------------------------------------1132-- Initialization1133-----------------------------------------------------------11341135local function Initialize()1136 BuildUI()1137 BuildSettingsContent()1138 SetupGlobalInput()1139 SetupKeyboardShortcuts()11401141 -- Load saved settings from server1142 task.spawn(function()1143 local SettingsEvents = ReplicatedStorage:WaitForChild("SettingsEvents", 5)1144 if SettingsEvents then1145 local LoadSettings = SettingsEvents:WaitForChild("LoadSettings", 5)1146 if LoadSettings then1147 local success, savedSettings = pcall(function()1148 return LoadSettings:InvokeServer()1149 end)1150 if success and savedSettings then1151 for key, value in pairs(savedSettings) do1152 if currentSettings[key] ~= nil then1153 currentSettings[key] = value1154 ApplySetting(key, value)1155 end1156 end1157 BuildSettingsContent()1158 end1159 end1160 end1161 end)11621163 print("[Settings] Settings Menu initialized. Use settings button or Escape key.")1164end11651166Initialize()