Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i get the name of the sound that's playing on a sound object?

Asked by 5 years ago
Edited 5 years ago

so, i am working on this game for my friend, which has a lot to do with sounds.. i ran into a problem when i realized that i don't know to get the name of a song that's currently playing...

how do i do it?

thanks

1 answer

Log in to vote
1
Answered by
Torren_Mr 334 Moderation Voter
5 years ago

Okay, you can use MarketPlaceService for that.

And to get the audio id without the rbxasset:// you need to format it.

The script is:

local sound = game.Workspace.Sound --The sound
local assetId = sound.SoundId --Getting the original soundId
local soundId = assetId:match("%d+") --Taking away the rbxassetid://

local product = game:GetService("MarketplaceService"):GetProductInfo(soundId) --Getting the audio

print(product.Name) --The Sound Name

If you have any further questions, comment.

0
thanks.. I need to start reading about roblox APIs.. But i am busy working on other things lol User#23252 26 — 5y
Ad

Answer this question