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 4 years ago

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..""
0
a little bit undescriptive isn't it? maumaumaumaumaumua 628 — 4y
0
How is this undescriptive? Nistrict 44 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
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)


0
This wont work since every time the players come back to the lobby it wont refresh the GUI. The music changes. Nistrict 44 — 4y
Ad
Log in to vote
0
Answered by 4 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

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
0
I feel like this is in the right direction just its not right.. Nistrict 44 — 4y

Answer this question