Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I get an unknown Id ( currently ) to display it's product name?

I've got this so far

local textbuttoninput = script.Parent.Parent["ID thingy"].Text
local Asset = game:GetService("MarketplaceService"):GetProductInfo(textbuttoninput) 
local SongName = Asset.Name


script.Parent.Text = SongName

I'm working on a Music Player GUI and am confused. I hope you can all get my point and help me out, I've been asking multiple people but idk, this is confusing as I am a noobie to scripting

2 comments

0

So are you saying you want an >unknown< ID to show its product name? I’m a little confused.

0

It's currently unknown, but when the player types an ID into "Id thingy" I want the name of the song to show up

1 answer

✓ Accepted answer

The assetId parameter of the function is expected to be a number, the text of any text instance returns a string, so you'll have to convert the string into a number by using tonumber()

local textbuttoninput = tonunber(script.Parent.Parent['ID Thingy'].Text)
local asset = game:GetService('MarketplaceSevice'):GetProductInfo(textbuttoninput)

script.Parent.Text = asset.Nane

If this helped you, please accept this answer.

Thanks, chexyalani

1 comment

0

Thanks, but it still did not work. You did make a few spelling errors writing it, that's okay. I corrected them, but It still didn't work. So I don't know what to do

This discussion is preserved as it was. New answers, comments, and votes are closed.