BLOXBUILDS
Discord
Back
UI/UX

Settings Menu

Paste into StarterPlayerScripts as a LocalScript. Adds a Settings button that toggles music and sets the game volume to low, medium, or full. Replace SOUND_ID with your audio.

-- Paste into StarterPlayer > StarterPlayerScripts as a LocalScript.
-- Replace SOUND_ID with your own audio.

local Players = game:GetService("Players")
local SoundService = game:GetService("SoundService")

local SOUND_ID = "rbxassetid://0"

local player = Players.LocalPlayer
local gui = Instance.new("ScreenGui")
gui.Name = "SettingsMenu"
gui.ResetOnSpawn = false
gui.Parent = player:WaitForChild("PlayerGui")

local music = Instance.new("Sound")
music.Name = "BackgroundMusic"
music.SoundId = SOUND_ID
music.Looped = true
music.Volume = 0.5
music.Parent = SoundService
music:Play()

local toggle = Instance.new("TextButton")
toggle.AnchorPoint = Vector2.new(1, 0)
toggle.Position = UDim2.new(1, -16, 0, 68)
toggle.Size = UDim2.fromOffset(110, 36)
toggle.BackgroundColor3 = Color3.fromRGB(30, 35, 48)
toggle.Text = "Settings"
toggle.TextColor3 = Color3.new(1, 1, 1)
toggle.Font = Enum.Font.GothamBold
toggle.TextSize = 15
toggle.Parent = gui

local panel = Instance.new("Frame")
panel.AnchorPoint = Vector2.new(1, 0)
panel.Position = UDim2.new(1, -16, 0, 112)
panel.Size = UDim2.fromOffset(220, 120)
panel.BackgroundColor3 = Color3.fromRGB(19, 22, 28)
panel.Visible = false
panel.Parent = gui

local musicButton = Instance.new("TextButton")
musicButton.Size = UDim2.new(1, -16, 0, 36)
musicButton.Position = UDim2.fromOffset(8, 12)
musicButton.BackgroundColor3 = Color3.fromRGB(30, 35, 48)
musicButton.Text = "Music: On"
musicButton.TextColor3 = Color3.new(1, 1, 1)
musicButton.Font = Enum.Font.GothamMedium
musicButton.TextSize = 15
musicButton.Parent = panel

local volumeButton = Instance.new("TextButton")
volumeButton.Size = UDim2.new(1, -16, 0, 36)
volumeButton.Position = UDim2.fromOffset(8, 56)
volumeButton.BackgroundColor3 = Color3.fromRGB(30, 35, 48)
volumeButton.Text = "Volume: Medium"
volumeButton.TextColor3 = Color3.new(1, 1, 1)
volumeButton.Font = Enum.Font.GothamMedium
volumeButton.TextSize = 15
volumeButton.Parent = panel

local musicOn = true
musicButton.MouseButton1Click:Connect(function()
	musicOn = not musicOn
	music.Volume = if musicOn then SoundService.Volume else 0
	musicButton.Text = if musicOn then "Music: On" else "Music: Off"
end)

local volumes = {
	{ name = "Low", value = 0.25 },
	{ name = "Medium", value = 0.6 },
	{ name = "Full", value = 1 },
}
local volumeIndex = 2

volumeButton.MouseButton1Click:Connect(function()
	volumeIndex = volumeIndex % #volumes + 1
	local choice = volumes[volumeIndex]
	SoundService.Volume = choice.value
	volumeButton.Text = "Volume: " .. choice.name
	if musicOn then
		music.Volume = choice.value
	end
end)

toggle.MouseButton1Click:Connect(function()
	panel.Visible = not panel.Visible
end)