For instance, I am trying to make an addition in my script where I play a sound id, There will be a GUI at the top of the screen where it says the name of the song, and the Id of the song.. I can't find out any ways, it's getting frustrating.
Example
CreateMessage("Now playing; " .. Asset.Name .. " - " .. Asset.Id)
Help?
Thanks...
If you use a Sound instance and name the relative sound with the respective sound asset and name you can do
1 | local sound = // |
2 |
3 | CreateMessage( "Now playing; " .. sound.Name .. " - " .. sound.SoundId |
Using MarketplaceService
:GetProductInfo
.
GetProductInfo returns a table of the information of the asset provided. It's really easy to use;
1 | function getInfo(id) |
2 | local info = game:GetService( "MarketplaceService" ):GetProductInfo(id) |
3 | return info |
4 | end |
Now, all you have to do is call the function with the ID to get the info (like this);
01 | player.Chatted:connect( function (msg) |
02 | local info = getInfo(msg) |
03 | print (info.Name.. "\n" ..info.Description) |
04 |
05 | --[[ |
06 | in the output; |
07 | Doge |
08 | Very hat. Such doge. Wow. |
09 | ]] -- |
10 |
11 | end ) |