Hello developers! I just dropped this audio player which can be used in games to play background music or just play music in general. The user is given the ability to manipulate most audio properties.
NOTE: I do not recommend you to use this audio player. It has many issues and needs to be worked on, it is also worth noting that I made this 2 years ago at a time where my scripting knowledge was pretty basic. I may rework this or fix all the obvious issues and when I do, I will bump this topic.
Edited on: 30/6/2024
This is my second resource!
UPDATE LOGS
1.1 Update!
Changed script to be more efficient
Changed “Effects” to be a bit smaller
1.2 Update!
Added new icon in model thumbnail!
Update 1.3
-
The Time Length in the music player was replaced with the name of the audio that is being played:
-
The "Show the ID of the current song is replaced with “Show song info”
The “Show song info” also contains the length of the current audio in Mins.
Update 1.4
Added Pause time and an option to disable the UI
Added an automatic instance placing script.
Fixed a few bugs
Changed some stuff
Changed some stuff in the instructions script.
You don’t have to credit me, but if you do, it would be greatly appreciated! (:
Roblox Model
Preview:
NOTE: This is not an accurate representation of the model. Updates were made, Check the Update logs in this post.
You can remove the credit if you want
Video preview (“Effects” text is smaller than it is shown on the video)
print("Thank you for using the The Ultimate Audio Player!") -- You can remove this if you want.
-- IF YOU DO NOT CHANGE THE "MUST CHANGE", THE WHOLE SCRIPT WONT WORK.
-- Do not delete this script, the whole model wont work without it.
-- Made by yousefoyoy
-- If you want to change some stuff, only change if it has "(Can be changed)" next to the "--" NOTE: YOU CAN ONLY CHANGE STUFF IF YOU KNOW WHAT YOU'RE DOING.
-- You can change the icons if you want
-- -------------> "(Must change)" means that you have to change it based on the instructions givin. <---------------
local music = game.Workspace.Music_Player -- Make sure that the audio is in workspace
local muteANDunmute = script.Parent.MuteAndUnmute
local info = script.Parent.Info
local OpenSettings = script.Parent.Settings
local settings_tab = script.Parent.Parent.Setting_Menu
local song_id = script.Parent.Parent.Song_ID
local setting_options = {settings_tab.Loop,settings_tab.Song_ID,settings_tab.Effects,settings_tab.Play_Your_own_song} -- This contains all of the settings in the "setting tab"
local effect_tab = script.Parent.Parent.Effects_Tab
local your_music = script.Parent.Parent.Your_music
local service = game:GetService("MarketplaceService")
local pause_between_audios = script.Parent.Pause_between_audio
local remove_audio_ui = false -- (NOT LOCAL) If you want the audio player UI to be removed then make this true.
local pause_time = 1 -- (Can be changed)
local sounds = {???,???,???} -- -----> (Must change) <----- Place the songs/sounds you want to use here. (make sure you separate each id with a comma. Like this: 1234567,7654321 )
pause_between_audios.Value = pause_time
music.SoundId = 'rbxassetid://'..sounds[math.random(1,#sounds)]
music.Playing = true
local Start_Song_ID_Name = music.SoundId:match("%d+") -- Getting the name of the song
info.Text = service:GetProductInfo(Start_Song_ID_Name,Enum.InfoType.Asset).Name
if remove_audio_ui == true then
game.ReplicatedStorage.Audio_player_remoteEvent:FireServer()
end
----------------------------------------------------------------------------------------------------------------------
muteANDunmute.MouseButton1Click:Connect(function() -- Mute and unmute
if music.Volume == 0 then
music.Volume = 1
muteANDunmute.Image = 'rbxassetid://7072724897'-- (Can be changed) Changes Audio Icon
else
music.Volume = 0
muteANDunmute.Image = 'rbxassetid://7072724946'-- (Can be changed) Changes Audio Icon
end
end)
music:GetPropertyChangedSignal("TimeLength"):Connect(function() -- Getting the name of the song when song is changed
local Song_ID_Name = music.SoundId:match("%d+")
info.Text = service:GetProductInfo(Song_ID_Name,Enum.InfoType.Asset).Name
end)
music.Ended:Connect(function()
task.wait(pause_between_audios.Value)
music.SoundId = 'rbxassetid://'..sounds[math.random(1,#sounds)]
music.Playing = true
end)
------------------------------------ Settings tab ------------------------------------
OpenSettings.MouseButton1Click:Connect(function() -- Setting tab: Open and close
settings_tab.Visible = not settings_tab.Visible
end)
setting_options[1].ImageButton.MouseButton1Click:Connect(function() -- Loop setting
if setting_options[1].ImageButton.Image == 'rbxassetid://7072722963' then
setting_options[1].ImageButton.Image = 'rbxassetid://7072706576'
music.Looped = true
else
setting_options[1].ImageButton.Image = 'rbxassetid://7072722963'
music.Looped = false
end
end)
setting_options[2].ImageButton.MouseButton1Click:Connect(function() -- Show ID setting
if setting_options[2].ImageButton.Image == 'rbxassetid://7072722963' then
setting_options[2].ImageButton.Image = 'rbxassetid://7072706576'
song_id.Visible = true
else
setting_options[2].ImageButton.Image = 'rbxassetid://7072722963'
song_id.Visible = false
end
end)
setting_options[3].ImageButton.MouseButton1Click:Connect(function()
if setting_options[3].ImageButton.Image == 'rbxassetid://7072722963' then
setting_options[3].ImageButton.Image = 'rbxassetid://7072706576'
effect_tab.Visible = true
else
setting_options[3].ImageButton.Image = 'rbxassetid://7072722963'
effect_tab.Visible = false
end
end)
setting_options[4].ImageButton.MouseButton1Click:Connect(function()
if setting_options[4].ImageButton.Image == 'rbxassetid://7072722963' then
setting_options[4].ImageButton.Image = 'rbxassetid://7072706576'
your_music.Visible = true
else
setting_options[4].ImageButton.Image = 'rbxassetid://7072722963'
your_music.Visible = false
end
end)
The main script (Contains instructions)
- Yes
- No
- I don’t need an audio player
0 voters
- 1
- 2
- 3
- 4
- 5
0 voters
If you have any suggestions, bug reports or you just want to give your opinion, feel free to post it in the comments below! (: