So, I tried this script first but it didn’t work. I don’t know what is the error here.
local mps = game:GetService("MarketplaceService")
local music = game.Workspace:WaitForChild("Sound")
local SongText = script.Parent.SongTitle
function updateMusic()
local id = string.gsub(music.SoundId, "rbxassetid://", "")
local success, info = pcall(mps.GetProductInfo, mps, id)
if success then
SongText.Text = info.Name
end
end
updateMusic()
music:GetPropertyChangedSignal("SoundId"):Connect(updateMusic)
The script is located inside a SurfaceGui that is located inside ScreenGui.