local sound = location-of-my-sound-piece local current = script.Parent.Sound
local songs = { [songId] = "songname", [songId2] = "songname2",
}sound:GetPropertyChangedSignal("SoundId"):Connect(function() local name = songs[tonumber(sound.SoundId:match("%d+"))] if name then current.Text = name .. " is currently playing." end end)
This is a script that changes a GUI's text label to the currently playing song, it was given to me by a guy on the discord server, and he gave up after not explaining it at all since I'm just a curious annoyance and he doesn't care.
My issue is that the way this functions made no sense. It's using tonumber() but, the way my playlist works is it sets the soundid to ("http://www.roblox.com/asset/?id="..songid). But how would this work with tonumber()? Does it locate the number inside of the link and then :match it to the songname? If not can you please explain it to me and how to properly utilize it.