Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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

1local Song = game.Workspace.LobbyMusic:GetChildren()
2 
3script.Parent = Song.Name..""
0
a little bit undescriptive isn't it? maumaumaumaumaumua 628 — 5y
0
How is this undescriptive? Nistrict 44 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
1local Song = game.Workspace.LobbyMusic:GetChildren()
2 
3local songplaying = script.Parent.CurrentSongPlaying.Name
4local gui = game.StarterGui.ScreenGui.PlayingSongDisplay -- Name anything you want
5game.Players.PlayerAdded:Connect(function()
6    gui.Text = songplaying
7end)
0
This wont work since every time the players come back to the lobby it wont refresh the GUI. The music changes. Nistrict 44 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

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

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

Now we'll have to select wich song is playing

1for key,value in next,Music do
2 
3if value.IsPlaying == true then -- Check if the sound is playing
4 
5script.Parent.Text = value.Name -- The name of the sound object, not marketplace sound name
6 
7end
8 
9end

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

01for key,value in next,Music do
02 
03if value.IsPlaying == true then -- Check if the sound is playing
04 
05script.Parent.Text = value.Name -- The name of the sound object, not marketplace sound name
06 
07end
08 
09value:GetPropertyChangedSignal("IsPlaying"):Connect(function()
10 
11if value.IsPlaying == true then
12 
13script.Parent.Text = value.Name -- The name of the sound object, not marketplace sound name
14 
15end
16 
17end)
18 
19end

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

01local Music = workspace.LobbyMusic:GetChildren() -- A table containing all the objects inside
02 
03for key,value in next,Music do
04 
05if value.IsPlaying == true then -- Check if the sound is playing
06 
07script.Parent.Text = value.Name -- The name of the sound object, not marketplace sound name
08 
09end
10 
11value:GetPropertyChangedSignal("IsPlaying"):Connect(function()
12 
13if value.IsPlaying == true then
14 
15script.Parent.Text = value.Name -- The name of the sound object, not marketplace sound name
View all 21 lines...
0
I feel like this is in the right direction just its not right.. Nistrict 44 — 5y

Answer this question