Making a music system for my game

I’m making a music system for my game. It has a feature where a player can buy a developer product and then add their own song to the game. So what I’m struggling with is getting the sound name. I’ve tried using MarketPlaceService:GetProductInfo() for the sound name but it errors saying “Unable to cast string to int64” and I’m not sure about another way to get the sound name or how to fix this. Thanks for your help! :wink:

2 Likes

try not using quotations if you are inside the GetProductInfo() function

1 Like

Hi @ReplacedLetter,

Your problem is that you are using a string in the ‘GetProductInfo’ method. This method takes the integer asset ID, not a string.

game:GetService("MarketplaceService"):GetProductInfo(123456).Name

This would give you the name of whatever asset 123456 is. This will get you the sound name.

You can then also query ‘AssetTypeId’ (instead of Name) to figure out if it’s a sound or not. You may also want to try loading the asset in a pcall, and handling it accordingly if it fails or succeeds.

1 Like

You probably want to use tonumber() to take the string the user typed in and turn it into a number value again.

1 Like