I get no errors but when it prints in the output it says false.. Does anyone know why?
local Music = workspace.LobbyMusic:GetChildren() for key,value in next,Music do print(value.IsPlaying) if value.IsPlaying == true then script.Parent.Text = value.Namename end value:GetPropertyChangedSignal("IsPlaying"):Connect(function() if value.IsPlaying == true then script.Parent.Text = value.Name end end) end
You got an error at line 5:
script.Parent.Text = value.Namename
Change that to
script.Parent.Text = value.Name
Hope that helped! Edit:
local Music = workspace.LobbyMusic:GetChildren() local currentsong while true do for key,value in next,Music do print(value.IsPlaying) if value.IsPlaying == true then script.Parent.Text = value.Name currentsong = value end wait(currentsong.TimeLength + 1) end end value:GetPropertyChangedSignal("IsPlaying"):Connect(function() if value.IsPlaying == true then script.Parent.Text = value.Name end end)
I think your end
and end)
are a bit messed up.
Use this fix that organizes them, it may fix it:
local Music = workspace.LobbyMusic:GetChildren() for key,value in next,Music do print(value.IsPlaying) if value.IsPlaying == true then script.Parent.Text = value.Namename end end value:GetPropertyChangedSignal("IsPlaying"):Connect(function() if value.IsPlaying == true then script.Parent.Text = value.Name end end)
here:
local Music = workspace.LobbyMusic:GetChildren() local marketplaceService = game:GetService("MarketplaceService") for key,value in next,Music do print(value.IsPlaying) if value.IsPlaying == true then script.Parent.Text = marketplaceService:GetProductInfo(Music.SoundId,1).Name end end value:GetPropertyChangedSignal("IsPlaying"):Connect(function() if value.IsPlaying == true then script.Parent.Text = marketplaceService:GetProductInfo(Music.SoundId,1).Name end end)
this will show the name of the ID automatically without having to update the name