Music Displayer not working on Surface GUI

  1. What do you want to achieve?
    I want my SurfaceGUI to display what music is currently playing, and fixing my Mute Script.

  2. What is the issue?
    The issue is that whenever a music players, the surface gui text doesn’t change. And my Mute Script is not working.

  3. What solutions have you tried so far?
    I haven’t found any solutions

This is my Jukebox


You can see the “Label” thats the surfacegui.

image
This is the surfacegui on the explorer.

This is the script that displays the music vvv (Local Script)

local textLabel = script.Parent
local currentTrack = game.ReplicatedStorage.CurrentTrack

if currentTrack.Value == "..." then 
	textLabel.Text = currentTrack.Value
else
	textLabel.Text = "Now Playing: " .. currentTrack.Value
end

currentTrack:GetPropertyChangedSignal("Value"):Connect(function()
	if currentTrack.Value == "..." then
		textLabel.Text =  currentTrack.Value
else
		textLabel.Text = "Now Playing: " .. currentTrack.Value
end
end)

This is my Mute script (Local Script)


local musicFolder = game.ReplicatedStorage.Music
local currentTrack = game.ReplicatedStorage.CurrentTrack

local muted = false

muteButton.MouseClick:Connect(function() 

	local nowPlaying = musicFolder[currentTrack.Value]

	nowPlaying.Volume = muted and 0.5 or 0
    
    muted = not muted
end)

currentTrack:GetPropertyChangedSignal("Value"):Connect(function()
    
	local nowPlaying = musicFolder[currentTrack.Value]

	if muted == true then 
		
		nowPlaying.Volume = 0

elseif muted == false then

		nowPlaying.Volume = 0.5
	end

 
end)

Im confused why it doesn’t work because it doesn’t show any errors in Output tab. If you have a solution to fix this i will appreciate it.

Also i followed a tutorial on youtube how to make this, then i want to implement it on SurfaceGUIs.

Hello,
could you please provide us a script that plays the music? There might be some issue with changing the CurrentTrack value or something else that makes the rest of your system not work.

Have a nice day!

1 Like

This is the Music Player script (LocalScript inside StarterPlayerScripts)

local musicFolder = game.Workspace.JukeBox.MusicPlayer.Displayer.Music
local availableMusic = musicFolder:GetChildren()
local currentTrack = game.ReplicatedStorage.CurrentTrack

while true do
   
	local randomTrack = availableMusic[math.random(1,#availableMusic)]

	currentTrack.Value = "..." -- Nothing is playing yet WOU
    
    wait(2)
         
   randomTrack:Play()

   currentTrack.Value = randomTrack.Name

	wait(randomTrack.TimeLength)
    
end

Oh yeah! Now I think I found the issue.
Local scripts do not run inside of Workspace.
This is a screenshot from the LocalScript documentation.

So in order to make the LocalScripts actually run, you will have to move them to one of these locations. I suggest you choosing StarterPlayerScripts.
It might be a great idea to implement the displaying music script right into the script where the music is being played from.
I think the system should work fine after you make this change, but if it doesn’t, feel free to get back to us.

Hope this was able to solve your issue,
have a nice day!

1 Like

Alright thanks for the information!

1 Like