My Audio Player
Key RequiredUniversal

My Audio Player

Universal Scriptddorredoreddorredore 299 views 8.5K executesUpdated Sep 1, 2026
Unrated
00
Lua Script•2411 lines (43959 chars)
--// Mobile Audio Player
--// Put this LocalScript in StarterPlayer > StarterPlayerScripts

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

local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

--==================================================
-- SETTINGS
--==================================================

local DEFAULT_VOLUME = 100
local DEFAULT_SPEED = 1.0
local DEFAULT_BASS = 0

local MIN_VOLUME = 0
local MAX_VOLUME = 200

local MIN_SPEED = 0.1
local MAX_SPEED = 5.0

local MIN_BASS = -10
local MAX_BASS = 10

local SEEK_AMOUNT = 5

--==================================================
-- EFFECT PRESETS
--==================================================

-- Slowed + Reverb
local SLOWED_MULTIPLIER = 0.82

local REVERB_DECAY_TIME = 3.2
local REVERB_DENSITY = 0.85
local REVERB_DIFFUSION = 0.9
local REVERB_DRY_LEVEL = -1
local REVERB_WET_LEVEL = -10

-- Sped Up
local SPED_UP_MULTIPLIER = 1.20

--==================================================
-- CLEAN OLD VERSION
--==================================================

local oldGui = playerGui:FindFirstChild("MobileAudioPlayer")

if oldGui then
	oldGui:Destroy()
end

local oldSound = SoundService:FindFirstChild("MobileAudioPlayer_Sound")

if oldSound then
	oldSound:Destroy()
end

--==================================================
-- SOUND
--==================================================

local sound = Instance.new("Sound")
sound.Name = "MobileAudioPlayer_Sound"
sound.Looped = true
sound.Volume = DEFAULT_VOLUME / 100
sound.PlaybackSpeed = DEFAULT_SPEED
sound.Parent = SoundService

--==================================================
-- BASS EQ
--==================================================

local equalizer = Instance.new("EqualizerSoundEffect")
equalizer.Name = "MobileAudioPlayer_Bass"

equalizer.LowGain = DEFAULT_BASS
equalizer.MidGain = 0
equalizer.HighGain = 0
equalizer.Enabled = true

equalizer.Parent = sound

--==================================================
-- SLOWED + REVERB
--==================================================

local slowedReverb = Instance.new("ReverbSoundEffect")
slowedReverb.Name = "MobileAudioPlayer_SlowedReverb"

slowedReverb.DecayTime = REVERB_DECAY_TIME
slowedReverb.Density = REVERB_DENSITY
slowedReverb.Diffusion = REVERB_DIFFUSION
slowedReverb.DryLevel = REVERB_DRY_LEVEL
slowedReverb.WetLevel = REVERB_WET_LEVEL

slowedReverb.Enabled = false
slowedReverb.Parent = sound

--==================================================
-- GUI
--==================================================

local gui = Instance.new("ScreenGui")
gui.Name = "MobileAudioPlayer"
gui.ResetOnSpawn = false
gui.IgnoreGuiInset = true
gui.Parent = playerGui

--==================================================
-- MAIN FRAME
--==================================================

local main = Instance.new("Frame")
main.Name = "Main"

-- Taller to fit Sped Up button.
main.Size = UDim2.fromOffset(300, 480)
main.Position = UDim2.new(0.5, -150, 0.5, -240)

main.BackgroundColor3 = Color3.fromRGB(25, 25, 30)
main.BorderSizePixel = 0
main.Active = true
main.Parent = gui

local mainCorner = Instance.new("UICorner")
mainCorner.CornerRadius = UDim.new(0, 13)
mainCorner.Parent = main

local stroke = Instance.new("UIStroke")
stroke.Thickness = 1.5
stroke.Color = Color3.fromRGB(70, 70, 80)
stroke.Parent = main

--==================================================
-- TITLE
--==================================================

local title = Instance.new("TextLabel")
title.Name = "Title"
title.Size = UDim2.new(1, -90, 0, 34)
title.Position = UDim2.fromOffset(10, 4)

title.BackgroundTransparency = 1
title.Text = "🎵 Audio Player"
title.TextColor3 = Color3.fromRGB(255, 255, 255)
title.TextSize = 18
title.Font = Enum.Font.GothamBold
title.TextXAlignment = Enum.TextXAlignment.Left
title.Parent = main

--==================================================
-- HIDE
--==================================================

local hideButton = Instance.new("TextButton")
hideButton.Name = "Hide"
hideButton.Size = UDim2.fromOffset(32, 28)
hideButton.Position = UDim2.new(1, -70, 0, 8)

hideButton.BackgroundColor3 = Color3.fromRGB(50, 50, 58)
hideButton.Text = "—"
hideButton.TextColor3 = Color3.fromRGB(255, 255, 255)
hideButton.TextSize = 19
hideButton.Font = Enum.Font.GothamBold
hideButton.Parent = main

local hideCorner = Instance.new("UICorner")
hideCorner.CornerRadius = UDim.new(0, 7)
hideCorner.Parent = hideButton

--==================================================
-- DELETE
--==================================================

local deleteButton = Instance.new("TextButton")
deleteButton.Name = "Delete"
deleteButton.Size = UDim2.fromOffset(32, 28)
deleteButton.Position = UDim2.new(1, -34, 0, 8)

deleteButton.BackgroundColor3 = Color3.fromRGB(170, 55, 55)
deleteButton.Text = "X"
deleteButton.TextColor3 = Color3.fromRGB(255, 255, 255)
deleteButton.TextSize = 15
deleteButton.Font = Enum.Font.GothamBold
deleteButton.Parent = main

local deleteCorner = Instance.new("UICorner")
deleteCorner.CornerRadius = UDim.new(0, 7)
deleteCorner.Parent = deleteButton

--==================================================
-- NOW PLAYING
--==================================================

local nowPlaying = Instance.new("TextLabel")
nowPlaying.Name = "NowPlaying"
nowPlaying.Size = UDim2.new(1, -20, 0, 22)
nowPlaying.Position = UDim2.fromOffset(10, 40)

nowPlaying.BackgroundTransparency = 1
nowPlaying.Text = "Now Playing: Nothing"
nowPlaying.TextColor3 = Color3.fromRGB(190, 190, 200)
nowPlaying.TextSize = 12
nowPlaying.Font = Enum.Font.GothamMedium
nowPlaying.TextXAlignment = Enum.TextXAlignment.Left
nowPlaying.TextTruncate = Enum.TextTruncate.AtEnd
nowPlaying.Parent = main

--==================================================
-- AUDIO ID LABEL
--==================================================

local idLabel = Instance.new("TextLabel")
idLabel.Size = UDim2.new(1, -20, 0, 18)
idLabel.Position = UDim2.fromOffset(10, 63)

idLabel.BackgroundTransparency = 1
idLabel.Text = "Audio ID"
idLabel.TextColor3 = Color3.fromRGB(170, 170, 180)
idLabel.TextSize = 12
idLabel.Font = Enum.Font.GothamMedium
idLabel.TextXAlignment = Enum.TextXAlignment.Left
idLabel.Parent = main

--==================================================
-- AUDIO ID BOX
--==================================================

local idBox = Instance.new("TextBox")
idBox.Name = "AudioID"
idBox.Size = UDim2.new(1, -20, 0, 34)
idBox.Position = UDim2.fromOffset(10, 83)

idBox.BackgroundColor3 = Color3.fromRGB(38, 38, 45)
idBox.BorderSizePixel = 0
idBox.PlaceholderText = "Enter audio ID..."
idBox.PlaceholderColor3 = Color3.fromRGB(130, 130, 140)
idBox.Text = ""
idBox.TextColor3 = Color3.fromRGB(255, 255, 255)
idBox.TextSize = 14
idBox.Font = Enum.Font.Gotham
idBox.ClearTextOnFocus = false
idBox.TextXAlignment = Enum.TextXAlignment.Left
idBox.Parent = main

local idPadding = Instance.new("UIPadding")
idPadding.PaddingLeft = UDim.new(0, 10)
idPadding.PaddingRight = UDim.new(0, 10)
idPadding.Parent = idBox

local idCorner = Instance.new("UICorner")
idCorner.CornerRadius = UDim.new(0, 8)
idCorner.Parent = idBox

--==================================================
-- PLAY / PAUSE
--==================================================

local playButton = Instance.new("TextButton")
playButton.Name = "PlayButton"
playButton.Size = UDim2.new(1, -20, 0, 34)
playButton.Position = UDim2.fromOffset(10, 123)

playButton.BackgroundColor3 = Color3.fromRGB(70, 130, 255)
playButton.BorderSizePixel = 0
playButton.Text = "▶  Play"
playButton.TextColor3 = Color3.fromRGB(255, 255, 255)
playButton.TextSize = 14
playButton.Font = Enum.Font.GothamBold
playButton.Parent = main

local playCorner = Instance.new("UICorner")
playCorner.CornerRadius = UDim.new(0, 8)
playCorner.Parent = playButton

--==================================================
-- TIME DISPLAY
--==================================================

local timeLabel = Instance.new("TextLabel")
timeLabel.Name = "Time"
timeLabel.Size = UDim2.new(1, -20, 0, 20)
timeLabel.Position = UDim2.fromOffset(10, 163)

timeLabel.BackgroundTransparency = 1
timeLabel.Text = "00:00 / 00:00"
timeLabel.TextColor3 = Color3.fromRGB(190, 190, 200)
timeLabel.TextSize = 12
timeLabel.Font = Enum.Font.GothamMedium
timeLabel.TextXAlignment = Enum.TextXAlignment.Center
timeLabel.Parent = main

--==================================================
-- SEEK BAR
--==================================================

local seekSlider = Instance.new("Frame")
seekSlider.Name = "SeekSlider"
seekSlider.Size = UDim2.new(1, -82, 0, 16)
seekSlider.Position = UDim2.fromOffset(41, 187)

seekSlider.BackgroundColor3 = Color3.fromRGB(55, 55, 65)
seekSlider.BorderSizePixel = 0
seekSlider.Active = true
seekSlider.Parent = main

local seekCorner = Instance.new("UICorner")
seekCorner.CornerRadius = UDim.new(1, 0)
seekCorner.Parent = seekSlider

local seekFill = Instance.new("Frame")
seekFill.Name = "Fill"
seekFill.Size = UDim2.new(0, 0, 1, 0)
seekFill.BackgroundColor3 = Color3.fromRGB(255, 170, 70)
seekFill.BorderSizePixel = 0
seekFill.Parent = seekSlider

local seekFillCorner = Instance.new("UICorner")
seekFillCorner.CornerRadius = UDim.new(1, 0)
seekFillCorner.Parent = seekFill

local seekKnob = Instance.new("Frame")
seekKnob.Name = "Knob"
seekKnob.Size = UDim2.fromOffset(18, 18)
seekKnob.AnchorPoint = Vector2.new(0.5, 0.5)
seekKnob.Position = UDim2.new(0, 0, 0.5, 0)

seekKnob.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
seekKnob.BorderSizePixel = 0
seekKnob.ZIndex = 3
seekKnob.Parent = seekSlider

local seekKnobCorner = Instance.new("UICorner")
seekKnobCorner.CornerRadius = UDim.new(1, 0)
seekKnobCorner.Parent = seekKnob

--==================================================
-- -5
--==================================================

local back5Button = Instance.new("TextButton")
back5Button.Name = "Back5"
back5Button.Size = UDim2.fromOffset(30, 28)
back5Button.Position = UDim2.fromOffset(7, 181)

back5Button.BackgroundColor3 = Color3.fromRGB(55, 55, 65)
back5Button.Text = "−5"
back5Button.TextColor3 = Color3.fromRGB(255, 255, 255)
back5Button.TextSize = 11
back5Button.Font = Enum.Font.GothamBold
back5Button.Parent = main

local back5Corner = Instance.new("UICorner")
back5Corner.CornerRadius = UDim.new(0, 7)
back5Corner.Parent = back5Button

--==================================================
-- +5
--==================================================

local forward5Button = Instance.new("TextButton")
forward5Button.Name = "Forward5"
forward5Button.Size = UDim2.fromOffset(30, 28)
forward5Button.Position = UDim2.new(1, -37, 0, 181)

forward5Button.BackgroundColor3 = Color3.fromRGB(55, 55, 65)
forward5Button.Text = "+5"
forward5Button.TextColor3 = Color3.fromRGB(255, 255, 255)
forward5Button.TextSize = 11
forward5Button.Font = Enum.Font.GothamBold
forward5Button.Parent = main

local forward5Corner = Instance.new("UICorner")
forward5Corner.CornerRadius = UDim.new(0, 7)
forward5Corner.Parent = forward5Button

--==================================================
-- VOLUME LABEL
--==================================================

local volumeLabel = Instance.new("TextLabel")
volumeLabel.Size = UDim2.new(1, -20, 0, 19)
volumeLabel.Position = UDim2.fromOffset(10, 211)

volumeLabel.BackgroundTransparency = 1
volumeLabel.Text = "Volume: 100%"
volumeLabel.TextColor3 = Color3.fromRGB(190, 190, 200)
volumeLabel.TextSize = 12
volumeLabel.Font = Enum.Font.GothamMedium
volumeLabel.TextXAlignment = Enum.TextXAlignment.Left
volumeLabel.Parent = main

--==================================================
-- VOLUME SLIDER
--==================================================

local volumeSlider = Instance.new("Frame")
volumeSlider.Name = "VolumeSlider"
volumeSlider.Size = UDim2.new(1, -20, 0, 15)
volumeSlider.Position = UDim2.fromOffset(10, 234)

volumeSlider.BackgroundColor3 = Color3.fromRGB(55, 55, 65)
volumeSlider.BorderSizePixel = 0
volumeSlider.Active = true
volumeSlider.Parent = main

local volumeSliderCorner = Instance.new("UICorner")
volumeSliderCorner.CornerRadius = UDim.new(1, 0)
volumeSliderCorner.Parent = volumeSlider

local initialVolumePercent =
	DEFAULT_VOLUME / MAX_VOLUME

local volumeFill = Instance.new("Frame")
volumeFill.Name = "Fill"
volumeFill.Size =
	UDim2.new(initialVolumePercent, 0, 1, 0)

volumeFill.BackgroundColor3 =
	Color3.fromRGB(80, 145, 255)

volumeFill.BorderSizePixel = 0
volumeFill.Parent = volumeSlider

local volumeFillCorner = Instance.new("UICorner")
volumeFillCorner.CornerRadius = UDim.new(1, 0)
volumeFillCorner.Parent = volumeFill

local volumeKnob = Instance.new("Frame")
volumeKnob.Name = "Knob"
volumeKnob.Size = UDim2.fromOffset(18, 18)
volumeKnob.AnchorPoint = Vector2.new(0.5, 0.5)

volumeKnob.Position =
	UDim2.new(initialVolumePercent, 0, 0.5, 0)

volumeKnob.BackgroundColor3 =
	Color3.fromRGB(255, 255, 255)

volumeKnob.BorderSizePixel = 0
volumeKnob.ZIndex = 3
volumeKnob.Parent = volumeSlider

local volumeKnobCorner = Instance.new("UICorner")
volumeKnobCorner.CornerRadius = UDim.new(1, 0)
volumeKnobCorner.Parent = volumeKnob

--==================================================
-- SPEED LABEL
--==================================================

local speedLabel = Instance.new("TextLabel")
speedLabel.Size = UDim2.new(1, -20, 0, 19)
speedLabel.Position = UDim2.fromOffset(10, 257)

speedLabel.BackgroundTransparency = 1
speedLabel.Text = "Speed: 1.0X"
speedLabel.TextColor3 = Color3.fromRGB(190, 190, 200)
speedLabel.TextSize = 12
speedLabel.Font = Enum.Font.GothamMedium
speedLabel.TextXAlignment = Enum.TextXAlignment.Left
speedLabel.Parent = main

--==================================================
-- SPEED SLIDER
--==================================================

local speedSlider = Instance.new("Frame")
speedSlider.Name = "SpeedSlider"
speedSlider.Size = UDim2.new(1, -20, 0, 15)
speedSlider.Position = UDim2.fromOffset(10, 280)

speedSlider.BackgroundColor3 = Color3.fromRGB(55, 55, 65)
speedSlider.BorderSizePixel = 0
speedSlider.Active = true
speedSlider.Parent = main

local speedSliderCorner = Instance.new("UICorner")
speedSliderCorner.CornerRadius = UDim.new(1, 0)
speedSliderCorner.Parent = speedSlider

local speedDefaultPercent =
	(DEFAULT_SPEED - MIN_SPEED) /
	(MAX_SPEED - MIN_SPEED)

local speedFill = Instance.new("Frame")
speedFill.Name = "Fill"
speedFill.Size =
	UDim2.new(speedDefaultPercent, 0, 1, 0)

speedFill.BackgroundColor3 =
	Color3.fromRGB(145, 95, 255)

speedFill.BorderSizePixel = 0
speedFill.Parent = speedSlider

local speedFillCorner = Instance.new("UICorner")
speedFillCorner.CornerRadius = UDim.new(1, 0)
speedFillCorner.Parent = speedFill

local speedKnob = Instance.new("Frame")
speedKnob.Name = "Knob"
speedKnob.Size = UDim2.fromOffset(18, 18)
speedKnob.AnchorPoint = Vector2.new(0.5, 0.5)
speedKnob.Position =
	UDim2.new(speedDefaultPercent, 0, 0.5, 0)

speedKnob.BackgroundColor3 =
	Color3.fromRGB(255, 255, 255)

speedKnob.BorderSizePixel = 0
speedKnob.ZIndex = 3
speedKnob.Parent = speedSlider

local speedKnobCorner = Instance.new("UICorner")
speedKnobCorner.CornerRadius = UDim.new(1, 0)
speedKnobCorner.Parent = speedKnob

--==================================================
-- BASS LABEL
--==================================================

local bassLabel = Instance.new("TextLabel")
bassLabel.Size = UDim2.new(1, -20, 0, 19)
bassLabel.Position = UDim2.fromOffset(10, 303)

bassLabel.BackgroundTransparency = 1
bassLabel.Text = "Bass: 0"
bassLabel.TextColor3 = Color3.fromRGB(190, 190, 200)
bassLabel.TextSize = 12
bassLabel.Font = Enum.Font.GothamMedium
bassLabel.TextXAlignment = Enum.TextXAlignment.Left
bassLabel.Parent = main

--==================================================
-- BASS SLIDER
--==================================================

local bassSlider = Instance.new("Frame")
bassSlider.Name = "BassSlider"
bassSlider.Size = UDim2.new(1, -20, 0, 15)
bassSlider.Position = UDim2.fromOffset(10, 326)

bassSlider.BackgroundColor3 = Color3.fromRGB(55, 55, 65)
bassSlider.BorderSizePixel = 0
bassSlider.Active = true
bassSlider.Parent = main

local bassSliderCorner = Instance.new("UICorner")
bassSliderCorner.CornerRadius = UDim.new(1, 0)
bassSliderCorner.Parent = bassSlider

local bassDefaultPercent =
	(DEFAULT_BASS - MIN_BASS) /
	(MAX_BASS - MIN_BASS)

local bassFill = Instance.new("Frame")
bassFill.Name = "Fill"
bassFill.Size =
	UDim2.new(bassDefaultPercent, 0, 1, 0)

bassFill.BackgroundColor3 =
	Color3.fromRGB(80, 200, 150)

bassFill.BorderSizePixel = 0
bassFill.Parent = bassSlider

local bassFillCorner = Instance.new("UICorner")
bassFillCorner.CornerRadius = UDim.new(1, 0)
bassFillCorner.Parent = bassFill

local bassKnob = Instance.new("Frame")
bassKnob.Name = "Knob"
bassKnob.Size = UDim2.fromOffset(18, 18)
bassKnob.AnchorPoint = Vector2.new(0.5, 0.5)
bassKnob.Position =
	UDim2.new(bassDefaultPercent, 0, 0.5, 0)

bassKnob.BackgroundColor3 =
	Color3.fromRGB(255, 255, 255)

bassKnob.BorderSizePixel = 0
bassKnob.ZIndex = 3
bassKnob.Parent = bassSlider

local bassKnobCorner = Instance.new("UICorner")
bassKnobCorner.CornerRadius = UDim.new(1, 0)
bassKnobCorner.Parent = bassKnob

--==================================================
-- CONTROL BUTTONS
--==================================================

local restartButton = Instance.new("TextButton")
restartButton.Name = "Restart"
restartButton.Size = UDim2.fromOffset(67, 30)
restartButton.Position = UDim2.fromOffset(10, 350)

restartButton.BackgroundColor3 = Color3.fromRGB(55, 55, 65)
restartButton.Text = "↻ Restart"
restartButton.TextColor3 = Color3.fromRGB(255, 255, 255)
restartButton.TextSize = 11
restartButton.Font = Enum.Font.GothamBold
restartButton.Parent = main

local restartCorner = Instance.new("UICorner")
restartCorner.CornerRadius = UDim.new(0, 7)
restartCorner.Parent = restartButton

local loopButton = Instance.new("TextButton")
loopButton.Name = "Loop"
loopButton.Size = UDim2.fromOffset(67, 30)
loopButton.Position = UDim2.fromOffset(82, 350)

loopButton.BackgroundColor3 =
	Color3.fromRGB(80, 145, 255)

loopButton.Text = "🔁 Loop: ON"
loopButton.TextColor3 = Color3.fromRGB(255, 255, 255)
loopButton.TextSize = 11
loopButton.Font = Enum.Font.GothamBold
loopButton.Parent = main

local loopCorner = Instance.new("UICorner")
loopCorner.CornerRadius = UDim.new(0, 7)
loopCorner.Parent = loopButton

local muteButton = Instance.new("TextButton")
muteButton.Name = "Mute"
muteButton.Size = UDim2.fromOffset(67, 30)
muteButton.Position = UDim2.fromOffset(154, 350)

muteButton.BackgroundColor3 =
	Color3.fromRGB(55, 55, 65)

muteButton.Text = "🔊 Mute"
muteButton.TextColor3 = Color3.fromRGB(255, 255, 255)
muteButton.TextSize = 11
muteButton.Font = Enum.Font.GothamBold
muteButton.Parent = main

local muteCorner = Instance.new("UICorner")
muteCorner.CornerRadius = UDim.new(0, 7)
muteCorner.Parent = muteButton

--==================================================
-- RESET BUTTON
--==================================================

local resetButton = Instance.new("TextButton")
resetButton.Name = "Reset"
resetButton.Size = UDim2.fromOffset(67, 30)
resetButton.Position = UDim2.fromOffset(226, 350)

resetButton.BackgroundColor3 =
	Color3.fromRGB(85, 85, 95)

resetButton.Text = "↺ Reset"
resetButton.TextColor3 = Color3.fromRGB(255, 255, 255)
resetButton.TextSize = 11
resetButton.Font = Enum.Font.GothamBold
resetButton.Parent = main

local resetCorner = Instance.new("UICorner")
resetCorner.CornerRadius = UDim.new(0, 7)
resetCorner.Parent = resetButton

--==================================================
-- SLOWED + REVERB BUTTON
--==================================================

local slowedReverbButton = Instance.new("TextButton")
slowedReverbButton.Name = "SlowedReverb"

slowedReverbButton.Size =
	UDim2.new(1, -20, 0, 30)

slowedReverbButton.Position =
	UDim2.fromOffset(10, 388)

slowedReverbButton.BackgroundColor3 =
	Color3.fromRGB(55, 55, 65)

slowedReverbButton.Text =
	"🌙 Slowed + Reverb: OFF"

slowedReverbButton.TextColor3 =
	Color3.fromRGB(255, 255, 255)

slowedReverbButton.TextSize = 12
slowedReverbButton.Font = Enum.Font.GothamBold
slowedReverbButton.Parent = main

local slowedReverbCorner = Instance.new("UICorner")
slowedReverbCorner.CornerRadius =
	UDim.new(0, 7)

slowedReverbCorner.Parent =
	slowedReverbButton

--==================================================
-- SPED UP BUTTON
--==================================================

local spedUpButton = Instance.new("TextButton")
spedUpButton.Name = "SpedUp"

spedUpButton.Size =
	UDim2.new(1, -20, 0, 30)

spedUpButton.Position =
	UDim2.fromOffset(10, 426)

spedUpButton.BackgroundColor3 =
	Color3.fromRGB(55, 55, 65)

spedUpButton.Text =
	"⚡ Sped Up: OFF"

spedUpButton.TextColor3 =
	Color3.fromRGB(255, 255, 255)

spedUpButton.TextSize = 12
spedUpButton.Font = Enum.Font.GothamBold
spedUpButton.Parent = main

local spedUpCorner = Instance.new("UICorner")
spedUpCorner.CornerRadius =
	UDim.new(0, 7)

spedUpCorner.Parent =
	spedUpButton

--==================================================
-- MINI BUTTON
--==================================================

local miniButton = Instance.new("TextButton")
miniButton.Name = "MiniButton"
miniButton.Size = UDim2.fromOffset(48, 48)
miniButton.Position = UDim2.new(0, 16, 0.5, -24)

miniButton.BackgroundColor3 =
	Color3.fromRGB(45, 45, 55)

miniButton.BorderSizePixel = 0
miniButton.Text = "🎵"
miniButton.TextSize = 21
miniButton.Visible = false
miniButton.Active = true
miniButton.ZIndex = 10
miniButton.Parent = gui

local miniCorner = Instance.new("UICorner")
miniCorner.CornerRadius =
	UDim.new(1, 0)

miniCorner.Parent =
	miniButton

local miniStroke = Instance.new("UIStroke")
miniStroke.Thickness = 1.5
miniStroke.Color =
	Color3.fromRGB(90, 90, 105)

miniStroke.Parent =
	miniButton

--==================================================
-- STATE
--==================================================

local destroyed = false

local loadedAudioId = nil

local loopEnabled = true
local muted = false

local slowedReverbEnabled = false
local spedUpEnabled = false

local savedVolume =
	DEFAULT_VOLUME / 100

-- This is the speed selected on the
-- normal speed slider BEFORE presets.
local selectedSpeed =
	DEFAULT_SPEED

local volumeDragging = false
local speedDragging = false
local bassDragging = false
local seekDragging = false

--==================================================
-- HELPERS
--==================================================

local function formatTime(seconds)

	seconds =
		math.max(
			0,
			math.floor(seconds)
		)

	local minutes =
		math.floor(seconds / 60)

	local secondsOnly =
		seconds % 60

	return string.format(
		"%02d:%02d",
		minutes,
		secondsOnly
	)
end

local function getAudioId()

	local text =
		idBox.Text

	text =
		text:gsub("%s+", "")

	text =
		text:gsub(
			"rbxassetid://",
			""
		)

	local numericId =
		tonumber(text)

	if not numericId then
		return nil
	end

	numericId =
		math.floor(numericId)

	if numericId <= 0 then
		return nil
	end

	return "rbxassetid://" ..
		numericId
end

--==================================================
-- EFFECTIVE SPEED
--==================================================

local function getEffectiveSpeed()

	local speed =
		selectedSpeed

	if slowedReverbEnabled then

		speed =
			speed
			* SLOWED_MULTIPLIER

	elseif spedUpEnabled then

		speed =
			speed
			* SPED_UP_MULTIPLIER
	end

	return math.clamp(
		speed,
		MIN_SPEED,
		MAX_SPEED
	)
end

local function applyPlaybackSpeed()

	sound.PlaybackSpeed =
		getEffectiveSpeed()

	-- Display the actual speed the
	-- player is currently hearing.
	local effectiveSpeed =
		getEffectiveSpeed()

	if slowedReverbEnabled then

		speedLabel.Text =
			string.format(
				"Speed: %.2fX (Slowed)",
				effectiveSpeed
			)

	elseif spedUpEnabled then

		speedLabel.Text =
			string.format(
				"Speed: %.2fX (Sped Up)",
				effectiveSpeed
			)

	else

		speedLabel.Text =
			string.format(
				"Speed: %.1fX",
				selectedSpeed
			)
	end
end

--==================================================
-- PLAY BUTTON STATES
--==================================================

local function setPlayingButton()

	playButton.Text =
		"⏸  Pause"

	playButton.BackgroundColor3 =
		Color3.fromRGB(
			180,
			65,
			65
		)
end

local function setPausedButton()

	playButton.Text =
		"▶  Resume"

	playButton.BackgroundColor3 =
		Color3.fromRGB(
			70,
			130,
			255
		)
end

local function setIdleButton()

	playButton.Text =
		"▶  Play"

	playButton.BackgroundColor3 =
		Color3.fromRGB(
			70,
			130,
			255
		)
end

--==================================================
-- SLOWED + REVERB UI
--==================================================

local function updateSlowedReverbUI()

	slowedReverb.Enabled =
		slowedReverbEnabled

	applyPlaybackSpeed()

	if slowedReverbEnabled then

		slowedReverbButton.Text =
			"🌙 Slowed + Reverb: ON"

		slowedReverbButton.BackgroundColor3 =
			Color3.fromRGB(
				105,
				85,
				155
			)

	else

		slowedReverbButton.Text =
			"🌙 Slowed + Reverb: OFF"

		slowedReverbButton.BackgroundColor3 =
			Color3.fromRGB(
				55,
				55,
				65
			)
	end
end

--==================================================
-- SPED UP UI
--==================================================

local function updateSpedUpUI()

	applyPlaybackSpeed()

	if spedUpEnabled then

		spedUpButton.Text =
			"⚡ Sped Up: ON"

		spedUpButton.BackgroundColor3 =
			Color3.fromRGB(
				185,
				125,
				55
			)

	else

		spedUpButton.Text =
			"⚡ Sped Up: OFF"

		spedUpButton.BackgroundColor3 =
			Color3.fromRGB(
				55,
				55,
				65
			)
	end
end

--==================================================
-- DRAGGING
--==================================================

local function makeDraggable(object)

	local dragging = false
	local dragStart
	local startPosition
	local dragInput

	local function update(input)

		local delta =
			input.Position -
			dragStart

		object.Position =
			UDim2.new(

				startPosition.X.Scale,
				startPosition.X.Offset
					+ delta.X,

				startPosition.Y.Scale,
				startPosition.Y.Offset
					+ delta.Y
			)
	end

	object.InputBegan:Connect(function(input)

		if destroyed then
			return
		end

		if input.UserInputType ==
			Enum.UserInputType.MouseButton1
			or input.UserInputType ==
			Enum.UserInputType.Touch then

			dragging = true

			dragStart =
				input.Position

			startPosition =
				object.Position

			dragInput =
				input
		end
	end)

	object.InputChanged:Connect(function(input)

		if input.UserInputType ==
			Enum.UserInputType.MouseMovement
			or input.UserInputType ==
			Enum.UserInputType.Touch then

			dragInput =
				input
		end
	end)

	UserInputService.InputChanged:Connect(function(input)

		if dragging
			and input == dragInput
			and not destroyed then

			update(input)
		end
	end)

	UserInputService.InputEnded:Connect(function(input)

		if input.UserInputType ==
			Enum.UserInputType.MouseButton1
			or input.UserInputType ==
			Enum.UserInputType.Touch then

			dragging = false
		end
	end)
end

makeDraggable(main)
makeDraggable(miniButton)

--==================================================
-- VOLUME
--==================================================

local function setVolumeFromInput(inputPosition)

	local position =
		volumeSlider.AbsolutePosition

	local size =
		volumeSlider.AbsoluteSize

	if size.X <= 0 then
		return
	end

	local percent =
		(
			inputPosition.X
			- position.X
		)
		/ size.X

	percent =
		math.clamp(
			percent,
			0,
			1
		)

	local volumePercent =
		math.floor(
			percent * MAX_VOLUME
			+ 0.5
		)

	volumePercent =
		math.clamp(
			volumePercent,
			MIN_VOLUME,
			MAX_VOLUME
		)

	savedVolume =
		volumePercent / 100

	if not muted then
		sound.Volume =
			savedVolume
	end

	volumeLabel.Text =
		"Volume: "
		.. volumePercent
		.. "%"

	volumeFill.Size =
		UDim2.new(
			percent,
			0,
			1,
			0
		)

	volumeKnob.Position =
		UDim2.new(
			percent,
			0,
			0.5,
			0
		)
end

volumeSlider.InputBegan:Connect(function(input)

	if input.UserInputType ==
		Enum.UserInputType.MouseButton1
		or input.UserInputType ==
		Enum.UserInputType.Touch then

		volumeDragging = true

		setVolumeFromInput(
			input.Position
		)
	end
end)

--==================================================
-- SPEED
--==================================================

local function setSpeedFromInput(inputPosition)

	local position =
		speedSlider.AbsolutePosition

	local size =
		speedSlider.AbsoluteSize

	if size.X <= 0 then
		return
	end

	local percent =
		(
			inputPosition.X
			- position.X
		)
		/ size.X

	percent =
		math.clamp(
			percent,
			0,
			1
		)

	local speed =
		MIN_SPEED
		+ (
			percent
			* (
				MAX_SPEED
				- MIN_SPEED
			)
		)

	speed =
		math.floor(
			speed * 10
			+ 0.5
		)
		/ 10

	speed =
		math.clamp(
			speed,
			MIN_SPEED,
			MAX_SPEED
		)

	selectedSpeed =
		speed

	applyPlaybackSpeed()

	local displayPercent =
		(
			speed
			- MIN_SPEED
		)
		/ (
			MAX_SPEED
			- MIN_SPEED
		)

	speedFill.Size =
		UDim2.new(
			displayPercent,
			0,
			1,
			0
		)

	speedKnob.Position =
		UDim2.new(
			displayPercent,
			0,
			0.5,
			0
		)
end

speedSlider.InputBegan:Connect(function(input)

	if input.UserInputType ==
		Enum.UserInputType.MouseButton1
		or input.UserInputType ==
		Enum.UserInputType.Touch then

		speedDragging = true

		setSpeedFromInput(
			input.Position
		)
	end
end)

--==================================================
-- BASS
--==================================================

local function setBassFromInput(inputPosition)

	local position =
		bassSlider.AbsolutePosition

	local size =
		bassSlider.AbsoluteSize

	if size.X <= 0 then
		return
	end

	local percent =
		(
			inputPosition.X
			- position.X
		)
		/ size.X

	percent =
		math.clamp(
			percent,
			0,
			1
		)

	local bass =
		MIN_BASS
		+ (
			percent
			* (
				MAX_BASS
				- MIN_BASS
			)
		)

	bass =
		math.floor(
			bass * 2
			+ 0.5
		)
		/ 2

	bass =
		math.clamp(
			bass,
			MIN_BASS,
			MAX_BASS
		)

	equalizer.LowGain =
		bass

	if bass == 0 then

		bassLabel.Text =
			"Bass: 0"

	else

		bassLabel.Text =
			string.format(
				"Bass: %+g",
				bass
			)
	end

	local displayPercent =
		(
			bass
			- MIN_BASS
		)
		/ (
			MAX_BASS
			- MIN_BASS
		)

	bassFill.Size =
		UDim2.new(
			displayPercent,
			0,
			1,
			0
		)

	bassKnob.Position =
		UDim2.new(
			displayPercent,
			0,
			0.5,
			0
		)
end

bassSlider.InputBegan:Connect(function(input)

	if input.UserInputType ==
		Enum.UserInputType.MouseButton1
		or input.UserInputType ==
		Enum.UserInputType.Touch then

		bassDragging = true

		setBassFromInput(
			input.Position
		)
	end
end)

--==================================================
-- SEEK
--==================================================

local function setSeekFromInput(inputPosition)

	local length =
		sound.TimeLength

	if length <= 0 then
		return
	end

	local position =
		seekSlider.AbsolutePosition

	local size =
		seekSlider.AbsoluteSize

	if size.X <= 0 then
		return
	end

	local percent =
		(
			inputPosition.X
			- position.X
		)
		/ size.X

	percent =
		math.clamp(
			percent,
			0,
			1
		)

	local newTime =
		percent * length

	sound.TimePosition =
		math.clamp(
			newTime,
			0,
			math.max(
				0,
				length - 0.01
			)
		)

	seekFill.Size =
		UDim2.new(
			percent,
			0,
			1,
			0
		)

	seekKnob.Position =
		UDim2.new(
			percent,
			0,
			0.5,
			0
		)
end

seekSlider.InputBegan:Connect(function(input)

	if input.UserInputType ==
		Enum.UserInputType.MouseButton1
		or input.UserInputType ==
		Enum.UserInputType.Touch then

		seekDragging = true

		setSeekFromInput(
			input.Position
		)
	end
end)

--==================================================
-- GLOBAL SLIDER INPUT
--==================================================

UserInputService.InputChanged:Connect(function(input)

	if input.UserInputType ~=
		Enum.UserInputType.MouseMovement
		and input.UserInputType ~=
		Enum.UserInputType.Touch then

		return
	end

	if volumeDragging then

		setVolumeFromInput(
			input.Position
		)
	end

	if speedDragging then

		setSpeedFromInput(
			input.Position
		)
	end

	if bassDragging then

		setBassFromInput(
			input.Position
		)
	end

	if seekDragging then

		setSeekFromInput(
			input.Position
		)
	end
end)

UserInputService.InputEnded:Connect(function(input)

	if input.UserInputType ==
		Enum.UserInputType.MouseButton1
		or input.UserInputType ==
		Enum.UserInputType.Touch then

		volumeDragging = false
		speedDragging = false
		bassDragging = false
		seekDragging = false
	end
end)

--==================================================
-- PLAY / PAUSE / RESUME
--==================================================

playButton.MouseButton1Click:Connect(function()

	if destroyed then
		return
	end

	local enteredId =
		getAudioId()

	if not enteredId then

		playButton.Text =
			"⚠ Invalid ID"

		task.delay(
			1.2,
			function()

				if destroyed then
					return
				end

				if sound.IsPlaying then
					setPlayingButton()

				elseif sound.IsPaused then
					setPausedButton()

				else
					setIdleButton()
				end
			end
		)

		return
	end

	--==============================================
	-- PAUSE
	--==============================================

	if sound.IsPlaying
		and loadedAudioId == enteredId then

		sound:Pause()

		setPausedButton()

		return
	end

	--==============================================
	-- RESUME
	--==============================================

	if sound.IsPaused
		and loadedAudioId == enteredId then

		sound:Resume()

		setPlayingButton()

		return
	end

	--==============================================
	-- LOAD NEW AUDIO
	--==============================================

	sound:Stop()

	sound.TimePosition =
		0

	loadedAudioId =
		nil

	nowPlaying.Text =
		"Loading: "
		.. enteredId

	timeLabel.Text =
		"00:00 / 00:00"

	seekFill.Size =
		UDim2.new(
			0,
			0,
			1,
			0
		)

	seekKnob.Position =
		UDim2.new(
			0,
			0,
			0.5,
			0
		)

	sound.SoundId =
		enteredId

	sound.Looped =
		loopEnabled

	applyPlaybackSpeed()

	setPlayingButton()

	sound:Play()

	loadedAudioId =
		enteredId

	--==============================================
	-- WAIT FOR LOAD
	--==============================================

	task.spawn(function()

		local thisId =
			enteredId

		local loaded =
			sound.IsLoaded

		local connection

		if not loaded then

			connection =
				sound.Loaded:Connect(
					function()
						loaded = true
					end
				)

			local startTime =
				os.clock()

			while not loaded
				and not destroyed
				and sound.SoundId == thisId
				and os.clock()
					- startTime < 15 do

				task.wait()
			end

			if connection then
				connection:Disconnect()
			end
		end

		if destroyed then
			return
		end

		if sound.SoundId ~= thisId then
			return
		end

		if sound.TimeLength > 0 then

			nowPlaying.Text =
				"Now Playing: "
				.. thisId

		else

			nowPlaying.Text =
				"Unable to load: "
				.. thisId
		end
	end)
end)

--==================================================
-- RESTART
--==================================================

restartButton.MouseButton1Click:Connect(function()

	if destroyed then
		return
	end

	if loadedAudioId == nil
		or sound.SoundId == "" then

		return
	end

	sound:Stop()

	sound.TimePosition =
		0

	sound.Looped =
		loopEnabled

	applyPlaybackSpeed()

	sound:Play()

	setPlayingButton()

	nowPlaying.Text =
		"Now Playing: "
		.. loadedAudioId
end)

--==================================================
-- LOOP
--==================================================

loopButton.MouseButton1Click:Connect(function()

	if destroyed then
		return
	end

	loopEnabled =
		not loopEnabled

	sound.Looped =
		loopEnabled

	if loopEnabled then

		loopButton.Text =
			"🔁 Loop: ON"

		loopButton.BackgroundColor3 =
			Color3.fromRGB(
				80,
				145,
				255
			)

	else

		loopButton.Text =
			"🔁 Loop: OFF"

		loopButton.BackgroundColor3 =
			Color3.fromRGB(
				55,
				55,
				65
			)
	end
end)

--==================================================
-- MUTE
--==================================================

muteButton.MouseButton1Click:Connect(function()

	if destroyed then
		return
	end

	muted =
		not muted

	if muted then

		sound.Volume =
			0

		muteButton.Text =
			"🔇 Unmute"

		muteButton.BackgroundColor3 =
			Color3.fromRGB(
				170,
				65,
				65
			)

	else

		sound.Volume =
			savedVolume

		muteButton.Text =
			"🔊 Mute"

		muteButton.BackgroundColor3 =
			Color3.fromRGB(
				55,
				55,
				65
			)
	end
end)

--==================================================
-- -5
--==================================================

back5Button.MouseButton1Click:Connect(function()

	if destroyed then
		return
	end

	if sound.TimeLength <= 0 then
		return
	end

	sound.TimePosition =
		math.clamp(
			sound.TimePosition
			- SEEK_AMOUNT,
			0,
			sound.TimeLength
		)
end)

--==================================================
-- +5
--==================================================

forward5Button.MouseButton1Click:Connect(function()

	if destroyed then
		return
	end

	if sound.TimeLength <= 0 then
		return
	end

	sound.TimePosition =
		math.clamp(
			sound.TimePosition
			+ SEEK_AMOUNT,
			0,
			sound.TimeLength
		)
end)

--==================================================
-- SLOWED + REVERB TOGGLE
--==================================================

slowedReverbButton.MouseButton1Click:Connect(function()

	if destroyed then
		return
	end

	slowedReverbEnabled =
		not slowedReverbEnabled

	-- Slowed and Sped Up are mutually exclusive.
	if slowedReverbEnabled then
		spedUpEnabled = false
	end

	updateSlowedReverbUI()
	updateSpedUpUI()
end)

--==================================================
-- SPED UP TOGGLE
--==================================================

spedUpButton.MouseButton1Click:Connect(function()

	if destroyed then
		return
	end

	spedUpEnabled =
		not spedUpEnabled

	-- Sped Up and Slowed + Reverb are
	-- mutually exclusive.
	if spedUpEnabled then
		slowedReverbEnabled = false
	end

	updateSlowedReverbUI()
	updateSpedUpUI()
end)

--==================================================
-- RESET
--==================================================

resetButton.MouseButton1Click:Connect(function()

	if destroyed then
		return
	end

	--==============================================
	-- VOLUME
	--==============================================

	muted =
		false

	savedVolume =
		DEFAULT_VOLUME / 100

	sound.Volume =
		savedVolume

	volumeLabel.Text =
		"Volume: 100%"

	local volumePercent =
		DEFAULT_VOLUME / MAX_VOLUME

	volumeFill.Size =
		UDim2.new(
			volumePercent,
			0,
			1,
			0
		)

	volumeKnob.Position =
		UDim2.new(
			volumePercent,
			0,
			0.5,
			0
		)

	muteButton.Text =
		"🔊 Mute"

	muteButton.BackgroundColor3 =
		Color3.fromRGB(
			55,
			55,
			65
		)

	--==============================================
	-- SPEED
	--==============================================

	selectedSpeed =
		DEFAULT_SPEED

	slowedReverbEnabled =
		false

	spedUpEnabled =
		false

	applyPlaybackSpeed()

	speedLabel.Text =
		"Speed: 1.0X"

	local speedPercent =
		(
			DEFAULT_SPEED
			- MIN_SPEED
		)
		/ (
			MAX_SPEED
			- MIN_SPEED
		)

	speedFill.Size =
		UDim2.new(
			speedPercent,
			0,
			1,
			0
		)

	speedKnob.Position =
		UDim2.new(
			speedPercent,
			0,
					0.5,
			0
		)

	--==============================================
	-- BASS
	--==============================================

	equalizer.LowGain =
		DEFAULT_BASS

	equalizer.MidGain =
		0

	equalizer.HighGain =
		0

	bassLabel.Text =
		"Bass: 0"

	local bassPercent =
		(
			DEFAULT_BASS
			- MIN_BASS
		)
		/ (
			MAX_BASS
			- MIN_BASS
		)

	bassFill.Size =
		UDim2.new(
			bassPercent,
			0,
			1,
			0
		)

	bassKnob.Position =
		UDim2.new(
			bassPercent,
			0,
			0.5,
			0
		)

	--==============================================
	-- LOOP
	--==============================================

	loopEnabled =
		true

	sound.Looped =
		true

	loopButton.Text =
		"🔁 Loop: ON"

	loopButton.BackgroundColor3 =
		Color3.fromRGB(
			80,
			145,
			255
		)

	--==============================================
	-- EFFECT UI
	--==============================================

	updateSlowedReverbUI()
	updateSpedUpUI()
end)

--==================================================
-- AUDIO ID BOX
--==================================================

idBox.FocusLost:Connect(function()

	if destroyed then
		return
	end

	local enteredId =
		getAudioId()

	if not enteredId then

		nowPlaying.Text =
			"Now Playing: Nothing"

		return
	end

	if loadedAudioId ==
		enteredId then

		nowPlaying.Text =
			"Now Playing: "
			.. enteredId

	else

		nowPlaying.Text =
			"Ready: "
			.. enteredId
	end
end)

--==================================================
-- SOUND ENDED
--==================================================

sound.Ended:Connect(function()

	if destroyed then
		return
	end

	if not sound.Looped then
		setIdleButton()
	end
end)

--==================================================
-- UPDATE TIME / DURATION
--==================================================

RunService.RenderStepped:Connect(function()

	if destroyed then
		return
	end

	if not gui.Parent then
		return
	end

	local length =
		sound.TimeLength

	local position =
		sound.TimePosition

	if length > 0 then

		position =
			math.clamp(
				position,
				0,
				length
			)

		local percent =
			math.clamp(
				position / length,
				0,
				1
			)

		timeLabel.Text =
			formatTime(position)
			.. " / "
			.. formatTime(length)

		if not seekDragging then

			seekFill.Size =
				UDim2.new(
					percent,
					0,
					1,
					0
				)

			seekKnob.Position =
				UDim2.new(
					percent,
					0,
					0.5,
					0
				)
		end

	else

		timeLabel.Text =
			"00:00 / 00:00"

		if not seekDragging then

			seekFill.Size =
				UDim2.new(
					0,
					0,
					1,
					0
				)

			seekKnob.Position =
				UDim2.new(
					0,
					0,
					0.5,
					0
				)
		end
	end

	if sound.IsPlaying then

		if playButton.Text ~=
			"⏸  Pause" then

			setPlayingButton()
		end

	elseif sound.IsPaused then

		if playButton.Text ~=
			"▶  Resume" then

			setPausedButton()
		end
	end
end)

--==================================================
-- HIDE
--==================================================

hideButton.MouseButton1Click:Connect(function()

	if destroyed then
		return
	end

	main.Visible =
		false

	miniButton.Visible =
		true
end)

--==================================================
-- SHOW
--==================================================

miniButton.MouseButton1Click:Connect(function()

	if destroyed then
		return
	end

	main.Visible =
		true

	miniButton.Visible =
		false
end)

--==================================================
-- DELETE
--==================================================

deleteButton.MouseButton1Click:Connect(function()

	if destroyed then
		return
	end

	destroyed =
		true

	sound:Stop()
	sound:Destroy()

	gui:Destroy()
end)

--==================================================
-- INITIAL STATE
--==================================================

selectedSpeed =
	DEFAULT_SPEED

sound.Volume =
	DEFAULT_VOLUME / 100

sound.PlaybackSpeed =
	DEFAULT_SPEED

sound.Looped =
	true

equalizer.LowGain =
	DEFAULT_BASS

equalizer.MidGain =
	0

equalizer.HighGain =
	0

slowedReverb.Enabled =
	false

slowedReverbEnabled =
	false

spedUpEnabled =
	false

loopEnabled =
	true

muted =
	false

volumeLabel.Text =
	"Volume: 100%"

speedLabel.Text =
	"Speed: 1.0X"

bassLabel.Text =
	"Bass: 0"

loopButton.Text =
	"🔁 Loop: ON"

muteButton.Text =
	"🔊 Mute"

slowedReverbButton.Text =
	"🌙 Slowed + Reverb: OFF"

spedUpButton.Text =
	"⚡ Sped Up: OFF"

playButton.Text =
	"▶  Play"

timeLabel.Text =
	"00:00 / 00:00"

nowPlaying.Text =
	"Now Playing: Nothing"

updateSlowedReverbUI()
updateSpedUpUI()

Features & Information

Erm.. it pretty uhh bugged out so yeah and also a free audio ID lol in the thumbnail you want to use it okay.

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts