Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I am trying to make a GUI that will show the music playing. Can anyone help?

I want the GUI to show what song is playing but this is all I got.. Im new to scripting sorry.

local Song = game.Workspace.LobbyMusic:GetChildren()

script.Parent = Song.Name..""

2 comments

0

a little bit undescriptive isn't it?

0

How is this undescriptive?

2 answers

local Song = game.Workspace.LobbyMusic:GetChildren()

local songplaying = script.Parent.CurrentSongPlaying.Name
local gui = game.StarterGui.ScreenGui.PlayingSongDisplay -- Name anything you want
game.Players.PlayerAdded:Connect(function()
	gui.Text = songplaying
end)
	

1 comment

0

This wont work since every time the players come back to the lobby it wont refresh the GUI. The music changes.

Alright, to start off, you didn't provide a lot of explanation and you also didn't specify what was on the parent but okay.

Let's assume that the parent is a text label and there are already songs on workspace.LobbyMusic First you'll have to get the song table

Wich is workspace.LobbyMusic:GetChildren()

PS: I'm using workspace instead of game.Workspace since it's shorter

local Music = workspace.LobbyMusic:GetChildren() -- A table containing all the objects inside

Now we'll have to select wich song is playing

for key,value in next,Music do

if value.IsPlaying == true then -- Check if the sound is playing

script.Parent.Text = value.Name -- The name of the sound object, not marketplace sound name

end

end

Now we'll detect whenever a song is playing For this we'll use GetPropertyChangedSignal to detect whenever a song starts playing

By the way, this is the same code above but we'll add more code

for key,value in next,Music do

if value.IsPlaying == true then -- Check if the sound is playing

script.Parent.Text = value.Name -- The name of the sound object, not marketplace sound name

end

value:GetPropertyChangedSignal("IsPlaying"):Connect(function()

if value.IsPlaying == true then

script.Parent.Text = value.Name -- The name of the sound object, not marketplace sound name

end

end)

end

And that's it! If this answered your question mark it as the answer Here is the final code if you want to copy it from here


local Music = workspace.LobbyMusic:GetChildren() -- A table containing all the objects inside

for key,value in next,Music do

if value.IsPlaying == true then -- Check if the sound is playing

script.Parent.Text = value.Name -- The name of the sound object, not marketplace sound name

end

value:GetPropertyChangedSignal("IsPlaying"):Connect(function()

if value.IsPlaying == true then

script.Parent.Text = value.Name -- The name of the sound object, not marketplace sound name

end

end)

end

1 comment

0

I feel like this is in the right direction just its not right..

This discussion is preserved as it was. New answers, comments, and votes are closed.