Script Is Not Displaying Song Name

I got an issue with my script. The script is able to play the song but doesnt display the name of the song. I cant figure it out.

Script:

local song = script.Parent.Song
local ids = {“4805888546”, “2692805133”, “1604537374”}

local marketplaceService = game:GetService(“MarketplaceService”)

while true do
for count = 1, #ids do
song.SoundId = “rbxassetid://”…ids[count]
songInfo = marketplaceService:GetProductInfo(ids[count])
song.Loaded:Wait()
song.TimePosition = 0
song:Play()
script.Parent.TextLabel.Text = "Now playing: "…songInfo.Name
song.Ended:Wait()
script.Parent.TextLabel.Text = “Loading next song…”
end
end

And for some reason devforum doesnt space out the script lol

the Image

Image

2 Likes

You concatonated using .:. But you only need to periods so you want . sorry I’m on mobile so I can’t rewrite the code but does that make sense? It’s not letting me do 2 periods, sorry I have never posted in mobile before

1 Like

Lol its ok I think I understand

1 Like

Are there errors in the output? I think that that’s the problem but maybe you can concatonate with 3 periods.

1 Like

No I tried finding it, doesnt even show.

1 Like

Finding errors or finding the output tab?

1 Like

Yea um nope I tried using the search filter “music” doesnt show any error

1 Like

I see. So the sound changes? Also does the text change or does it stay the same permanently.

1 Like

It stays the same, music works fine its just the text doesnt change

1 Like

Nvm I found a Forum which says ScreenGui isnt able to change text

1 Like

Hello hwoagh_a!

I went ahead and revised your code for you. It works in the way you should expect with the same layout in the image you provided.

local songids = {
	4805888546,
	2692805133,
	1604537374
}
--
local marketplaceservice = game:GetService("MarketplaceService")
--
local song = script.Parent.Song
local songinfo = nil
--
while wait() do
	for i = 1,#songids do
		--
		song.SoundId = "rbxassetid://" .. songids[i]
		songinfo = marketplaceservice:GetProductInfo(songids[i])
		song.Loaded:Wait()
		--
		song:Play()
		script.Parent.TextLabel.Text = "Now playing: " .. songinfo.Name
		--
		song.Stopped:Wait()
		script.Parent.TextLabel.Text = "Loading next song..."
		wait(math.random(2,3))
		--
	end
end
2 Likes

Rip it doesnt work. probably because its in startergui but thanks for trying

1 Like

Local TextLabel = script.Parent:WaitForChild(“TextLabel”)

Local Song = script.Parent: WaitForChild (“Song”)
Song.SongId.Value = 1
TextLabel.Text= “Song Name”

Maybe this works but you have to put the sounds individually unfortunately I can’t correct your script because I’m on cell phone but I hope it works

1 Like