I am trying to make a server-side music system, but MarketplaceService doesn't properly work.
Script:
game.ReplicatedStorage.MusicSystem.NewSong.OnClientEvent:Connect(function(music) progres.Size = UDim2.new(0,0,1,0) local song = game.Workspace.SoundSystem.Music.SoundId local asset = game.MarketplaceService:GetProductInfo(song) -- This is the line the Error is on. songName.Text = asset.Name progres:TweenSize(UDim2.new(1,0,1,0),'Out','Linear',(song.TimeLength)-1) end)
Error: Unable to cast string to int64
Sometimes the error doesn't show up at all.
local asset = game.MarketplaceService:GetProductInfo(tonumber(song), Enum.InfoType.Asset)
Try this, your SoundId may be returning a string. I believe you also need to declare an InfoType, AKA GamePass, Dev Product, etc.
https://developer.roblox.com/en-us/api-reference/function/MarketplaceService/GetProductInfo source ^