explore
key systems
new
docs
discord
search scripts
⌘K
explore
key systems
new
docs
discord
sign in
⌘↵
--
publishes from anywhere on this page
new paste
untitled.luau
empty
/ 512kb
open file
⌘O
explore
key systems
new
docs
sign in
volumecontrol-copy.luau
600 lines · 17.8kb
/ 512kb
open file
⌘O
local Players = game:GetService("Players") local SoundService = game:GetService("SoundService") local UserInputService = game:GetService("UserInputService") local TweenService = game:GetService("TweenService") local plr = Players.LocalPlayer local volume = 1 local muted = false local storedVolume = 1 local alive, animating = true, false local MASTER = SoundService:FindFirstChild("x4aq_master") if MASTER and not MASTER:IsA("SoundGroup") then MASTER:Destroy() MASTER = nil end if not MASTER then MASTER = Instance.new("SoundGroup") MASTER.Name = "x4aq_master" MASTER.Parent = SoundService end local PREFIX = "x4aq_" local hooked = setmetatable({}, {__mode = "k"}) local childFor = setmetatable({}, {__mode = "k"}) local original = setmetatable({}, {__mode = "k"}) local connections = {} local function track(c) table.insert(connections, c) return c end local function makeChild(g) if g == MASTER then return MASTER end if g.Name:sub(1, #PREFIX) == PREFIX then childFor[g] = g return g end local c = g:FindFirstChild(PREFIX .. g.Name) if not c then c = Instance.new("SoundGroup") c.Name = PREFIX .. g.Name c.Parent = g end childFor[g] = c return c end local function attach(s) if not s:IsA("Sound") then return end if original[s] == nil then original[s] = s.SoundGroup end local t = s.SoundGroup == nil and MASTER or makeChild(s.SoundGroup) if s.SoundGroup ~= t then s.SoundGroup = t end end local function watch(s) if hooked[s] then return end hooked[s] = true attach(s) track(s:GetPropertyChangedSignal("SoundGroup"):Connect(function() if not alive then return end local t = s.SoundGroup == nil and MASTER or makeChild(s.SoundGroup) if s.SoundGroup ~= t then s.SoundGroup = t end end)) track(s.AncestryChanged:Connect(function() task.defer(function() if alive and s.Parent then attach(s) end end) end)) end local roots = {SoundService, workspace} if plr then table.insert(roots, plr) end local function sweep(c) for _, d in ipairs(c:GetDescendants()) do if d:IsA("Sound") then watch(d) end end end for _, c in ipairs(roots) do sweep(c) track(c.DescendantAdded:Connect(function(d) if d:IsA("Sound") then watch(d) end end)) end local function effective() return muted and 0 or volume end local function apply() local v = effective() MASTER.Volume = v for g, c in pairs(childFor) do if c and c.Parent == g then c.Volume = v end end for _, d in ipairs(SoundService:GetDescendants()) do if d:IsA("SoundGroup") and d.Name:sub(1, #PREFIX) == PREFIX then d.Volume = v end end end task.spawn(function() while alive do task.wait(0.5) if not alive then break end local v = effective() MASTER.Volume = v for g, c in pairs(childFor) do if c and c.Parent == g then c.Volume = v end end for _, c in ipairs(roots) do if c.Parent then sweep(c) end end end end) local BG = Color3.fromRGB(14, 14, 16) local LINE = Color3.fromRGB(34, 34, 38) local TEXT = Color3.fromRGB(232, 232, 234) local DIM = Color3.fromRGB(108, 108, 116) local ACCENT = Color3.fromRGB(222, 176, 96) local DANGER = Color3.fromRGB(212, 100, 100) local MUTE_BG = Color3.fromRGB(28, 21, 13) local MUTE_LINE = Color3.fromRGB(96, 74, 40) local GLYPHS = { "░","▒","▓","█","◤","◥","◣","◢", "╱","╲","╳","●","◐","◑","◒","◓", "▪","▫","◆","◇","★","☆","▲","△" } local gui = Instance.new("ScreenGui") gui.Name = "x4aq" gui.ResetOnSpawn = false gui.IgnoreGuiInset = true gui.Parent = plr:WaitForChild("PlayerGui") local panel = Instance.new("Frame") panel.Size = UDim2.fromOffset(360, 176) panel.Position = UDim2.new(0.5, -180, 0.5, -88) panel.BackgroundColor3 = BG panel.BorderSizePixel = 0 panel.Active = true panel.Draggable = true panel.ClipsDescendants = true panel.Parent = gui Instance.new("UICorner", panel).CornerRadius = UDim.new(0, 6) local ps = Instance.new("UIStroke", panel) ps.Color = LINE ps.Thickness = 1 local uiScale = Instance.new("UIScale") uiScale.Scale = 1 uiScale.Parent = panel local pad = Instance.new("UIPadding", panel) pad.PaddingTop = UDim.new(0, 16) pad.PaddingLeft = UDim.new(0, 18) pad.PaddingRight = UDim.new(0, 18) local titleRow = Instance.new("Frame") titleRow.Size = UDim2.new(1, 0, 0, 16) titleRow.BackgroundTransparency = 1 titleRow.Parent = panel local title = Instance.new("TextLabel") title.Size = UDim2.new(1, -68, 1, 0) title.BackgroundTransparency = 1 title.Font = Enum.Font.GothamMedium title.TextSize = 12 title.TextColor3 = TEXT title.TextXAlignment = Enum.TextXAlignment.Left title.Text = "x4axq made" title.Parent = titleRow local btnMin = Instance.new("TextButton") btnMin.Size = UDim2.fromOffset(22, 16) btnMin.Position = UDim2.new(1, -46, 0, 0) btnMin.BackgroundTransparency = 1 btnMin.Font = Enum.Font.GothamMedium btnMin.TextSize = 14 btnMin.TextColor3 = DIM btnMin.Text = "-" btnMin.AutoButtonColor = false btnMin.Parent = titleRow local btnClose = Instance.new("TextButton") btnClose.Size = UDim2.fromOffset(22, 16) btnClose.Position = UDim2.new(1, -22, 0, 0) btnClose.BackgroundTransparency = 1 btnClose.Font = Enum.Font.GothamMedium btnClose.TextSize = 12 btnClose.TextColor3 = DIM btnClose.Text = "x" btnClose.AutoButtonColor = false btnClose.Parent = titleRow btnMin.MouseEnter:Connect(function() btnMin.TextColor3 = TEXT end) btnMin.MouseLeave:Connect(function() btnMin.TextColor3 = DIM end) btnClose.MouseEnter:Connect(function() btnClose.TextColor3 = DANGER end) btnClose.MouseLeave:Connect(function() btnClose.TextColor3 = DIM end) local readout = Instance.new("TextLabel") readout.Size = UDim2.new(1, 0, 0, 46) readout.Position = UDim2.new(0, 0, 0, 28) readout.BackgroundTransparency = 1 readout.Font = Enum.Font.GothamBold readout.TextSize = 38 readout.TextColor3 = TEXT readout.TextXAlignment = Enum.TextXAlignment.Left readout.RichText = true readout.Text = '100.0<font size="18">%</font>' readout.Parent = panel local barTrack = Instance.new("Frame") barTrack.Size = UDim2.new(1, 0, 0, 3) barTrack.Position = UDim2.new(0, 0, 0, 88) barTrack.BackgroundColor3 = LINE barTrack.BorderSizePixel = 0 barTrack.Parent = panel Instance.new("UICorner", barTrack).CornerRadius = UDim.new(1, 0) local barFill = Instance.new("Frame") barFill.Size = UDim2.new(1, 0, 1, 0) barFill.BackgroundColor3 = ACCENT barFill.BorderSizePixel = 0 barFill.Parent = barTrack Instance.new("UICorner", barFill).CornerRadius = UDim.new(1, 0) local barHit = Instance.new("TextButton") barHit.Size = UDim2.new(1, 0, 0, 24) barHit.Position = UDim2.new(0, 0, 0, 77) barHit.BackgroundTransparency = 1 barHit.Text = "" barHit.AutoButtonColor = false barHit.Parent = panel local scrambleToken = 0 local function stopScramble() scrambleToken = scrambleToken + 1 end local function scrambleNum(finalNumStr) scrambleToken = scrambleToken + 1 local token = scrambleToken local frames = 12 task.spawn(function() for f = 1, frames do if token ~= scrambleToken or not alive then return end local progress = f / frames local corruptChance = 1 - progress * progress local out = {} for i = 1, #finalNumStr do local ch = finalNumStr:sub(i, i) if ch:match("[%w]") and math.random() < corruptChance then out[i] = GLYPHS[math.random(#GLYPHS)] else out[i] = ch end end readout.Text = table.concat(out) .. '<font size="18">%</font>' task.wait(0.02) end if token ~= scrambleToken or not alive then return end readout.Text = finalNumStr .. '<font size="18">%</font>' end) end local function scrambleText(finalText) scrambleToken = scrambleToken + 1 local token = scrambleToken local frames = 12 task.spawn(function() for f = 1, frames do if token ~= scrambleToken or not alive then return end local progress = f / frames local corruptChance = 1 - progress * progress local out = {} for i = 1, #finalText do local ch = finalText:sub(i, i) if ch:match("[%w]") and math.random() < corruptChance then out[i] = GLYPHS[math.random(#GLYPHS)] else out[i] = ch end end readout.Text = table.concat(out) task.wait(0.02) end if token ~= scrambleToken or not alive then return end readout.Text = finalText end) end local function writeReadoutDirect() readout.TextColor3 = muted and ACCENT or TEXT if muted then readout.Text = "muted" else readout.Text = string.format('%.1f<font size="18">%%</font>', volume * 100) end end local function animateReadout() readout.TextColor3 = muted and ACCENT or TEXT if muted then scrambleText("muted") else scrambleNum(string.format("%.1f", volume * 100)) end end local function setFill(animated, target) local tar = target or (muted and 0 or volume) if animated then TweenService:Create(barFill, TweenInfo.new(0.32, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {Size = UDim2.new(tar, 0, 1, 0)}):Play() else barFill.Size = UDim2.new(tar, 0, 1, 0) end end local function setVolume(v, animated) if muted then return end volume = math.clamp(v, 0, 1) apply() setFill(animated) if animated then animateReadout() else stopScramble() writeReadoutDirect() end end local presetRow = Instance.new("Frame") presetRow.Size = UDim2.new(1, 0, 0, 16) presetRow.Position = UDim2.new(0, 0, 0, 104) presetRow.BackgroundTransparency = 1 presetRow.Parent = panel local prl = Instance.new("UIListLayout", presetRow) prl.FillDirection = Enum.FillDirection.Horizontal prl.Padding = UDim.new(0, 6) prl.HorizontalAlignment = Enum.HorizontalAlignment.Center prl.SortOrder = Enum.SortOrder.LayoutOrder local function textBtn(parent, label, size) local b = Instance.new("TextButton") b.Size = UDim2.fromOffset(size or 32, 16) b.BackgroundTransparency = 1 b.Font = Enum.Font.GothamMedium b.TextSize = 11 b.TextColor3 = DIM b.Text = label b.AutoButtonColor = false b.Parent = parent b.MouseEnter:Connect(function() b.TextColor3 = ACCENT end) b.MouseLeave:Connect(function() b.TextColor3 = DIM end) return b end for _, p in ipairs({{0.001,"0.1%"},{0.01,"1%"},{0.02,"2%"},{0.05,"5%"},{0.10,"10%"},{0.25,"25%"},{0.50,"50%"},{1.0,"100%"}}) do local b = textBtn(presetRow, p[2]) b.MouseButton1Click:Connect(function() setVolume(p[1], true) end) end local muteBtn = Instance.new("TextButton") muteBtn.Size = UDim2.fromOffset(82, 22) muteBtn.AnchorPoint = Vector2.new(0.5, 0) muteBtn.Position = UDim2.new(0.5, 0, 0, 132) muteBtn.BackgroundColor3 = Color3.fromRGB(22, 22, 25) muteBtn.BorderSizePixel = 0 muteBtn.Font = Enum.Font.GothamMedium muteBtn.TextSize = 11 muteBtn.TextColor3 = DIM muteBtn.Text = "mute" muteBtn.AutoButtonColor = false muteBtn.Parent = panel Instance.new("UICorner", muteBtn).CornerRadius = UDim.new(0, 4) local muteStroke = Instance.new("UIStroke", muteBtn) muteStroke.Color = LINE muteStroke.Thickness = 1 muteBtn.MouseButton1Click:Connect(function() muted = not muted if muted then storedVolume = volume muteBtn.Text = "unmute" muteBtn.TextColor3 = ACCENT muteBtn.BackgroundColor3 = MUTE_BG muteStroke.Color = MUTE_LINE else volume = storedVolume muteBtn.Text = "mute" muteBtn.TextColor3 = DIM muteBtn.BackgroundColor3 = Color3.fromRGB(22, 22, 25) muteStroke.Color = LINE end apply() setFill(true, muted and 0 or volume) animateReadout() end) -- Scale Buttons local scaleRow = Instance.new("Frame") scaleRow.Size = UDim2.new(0, 80, 0, 16) scaleRow.Position = UDim2.new(1, 0, 1, -14) scaleRow.AnchorPoint = Vector2.new(1, 1) scaleRow.BackgroundTransparency = 1 scaleRow.Parent = panel local srl = Instance.new("UIListLayout", scaleRow) srl.FillDirection = Enum.FillDirection.Horizontal srl.Padding = UDim.new(0, 8) srl.HorizontalAlignment = Enum.HorizontalAlignment.Right srl.SortOrder = Enum.SortOrder.LayoutOrder local BASE_SCALE = 1 local function applyGuiScale(mult) TweenService:Create(uiScale, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Scale = BASE_SCALE * mult}):Play() end local s05 = textBtn(scaleRow, "0.5x", 24) s05.MouseButton1Click:Connect(function() applyGuiScale(0.5) end) local s1 = textBtn(scaleRow, "1x", 20) s1.MouseButton1Click:Connect(function() applyGuiScale(1) end) local s2 = textBtn(scaleRow, "2x", 20) s2.MouseButton1Click:Connect(function() applyGuiScale(1.5) end) -- Slider drag local dragging = false local function fromX(x) setVolume((x - barTrack.AbsolutePosition.X) / barTrack.AbsoluteSize.X, false) end barHit.InputBegan:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then dragging = true fromX(i.Position.X) end end) UserInputService.InputChanged:Connect(function(i) if dragging and (i.UserInputType == Enum.UserInputType.MouseMovement or i.UserInputType == Enum.UserInputType.Touch) then fromX(i.Position.X) end end) UserInputService.InputEnded:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then dragging = false end end) -- Minimize / Restore local restore = Instance.new("TextButton") restore.Size = UDim2.fromOffset(0, 26) restore.Position = UDim2.new(0.5, 0, 0, 12) restore.BackgroundColor3 = BG restore.BorderSizePixel = 0 restore.Font = Enum.Font.GothamBold restore.TextSize = 14 restore.TextColor3 = ACCENT restore.Text = "x" restore.Visible = false restore.AutoButtonColor = false restore.Active = true restore.Parent = gui Instance.new("UICorner", restore).CornerRadius = UDim.new(0, 4) local rstr = Instance.new("UIStroke", restore) rstr.Color = LINE rstr.Thickness = 1 restore.MouseEnter:Connect(function() restore.TextColor3 = TEXT end) restore.MouseLeave:Connect(function() restore.TextColor3 = ACCENT end) local restoreDragging = false local dragStart, boxStart local moved = false local restorePanel restore.InputBegan:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then restoreDragging = true moved = false dragStart = Vector2.new(i.Position.X, i.Position.Y) boxStart = Vector2.new(restore.Position.X.Offset, restore.Position.Y.Offset) end end) UserInputService.InputChanged:Connect(function(i) if not restoreDragging then return end if i.UserInputType == Enum.UserInputType.MouseMovement or i.UserInputType == Enum.UserInputType.Touch then local dx = i.Position.X - dragStart.X local dy = i.Position.Y - dragStart.Y if math.abs(dx) > 2 or math.abs(dy) > 2 then moved = true end restore.Position = UDim2.new( restore.Position.X.Scale, boxStart.X + dx, restore.Position.Y.Scale, boxStart.Y + dy) end end) UserInputService.InputEnded:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then if restoreDragging and not moved then restorePanel() end restoreDragging = false end end) local function minimize() if not panel.Visible or animating then return end animating = true local t = TweenService:Create(panel, TweenInfo.new(0.24, Enum.EasingStyle.Quart, Enum.EasingDirection.In), {Size = UDim2.fromOffset(360, 0)}) t.Completed:Connect(function() panel.Visible = false panel.Size = UDim2.fromOffset(360, 176) restore.Visible = true restore.Size = UDim2.fromOffset(0, 26) restore.Position = UDim2.new(0.5, 0, 0, 12) TweenService:Create(restore, TweenInfo.new(0.22, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {Size = UDim2.fromOffset(38, 26), Position = UDim2.new(0.5, -19, 0, 12)}):Play() animating = false end) t:Play() end restorePanel = function() if panel.Visible or animating then return end animating = true TweenService:Create(restore, TweenInfo.new(0.16, Enum.EasingStyle.Quart, Enum.EasingDirection.In), {Size = UDim2.fromOffset(0, 26)}):Play() task.delay(0.16, function() restore.Visible = false panel.Visible = true panel.Size = UDim2.fromOffset(360, 0) TweenService:Create(panel, TweenInfo.new(0.24, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {Size = UDim2.fromOffset(360, 176)}):Play() animating = false end) end btnMin.MouseButton1Click:Connect(minimize) btnClose.MouseButton1Click:Connect(function() alive = false for _, c in ipairs(connections) do pcall(function() c:Disconnect() end) end table.clear(connections) for s, g in pairs(original) do if s.Parent then pcall(function() s.SoundGroup = g end) end end MASTER.Volume = 1 pcall(function() gui:Destroy() end) end) UserInputService.InputBegan:Connect(function(i, processed) if processed then return end if i.KeyCode == Enum.KeyCode.Backquote then if panel.Visible then minimize() else restorePanel() end elseif i.KeyCode == Enum.KeyCode.Minus then setVolume(volume - 0.05, false) elseif i.KeyCode == Enum.KeyCode.Equals then setVolume(volume + 0.05, false) end end) apply() setFill(false) writeReadoutDirect()