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

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

Asked by 6 years ago
Edited 6 years ago

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

0
So are you saying you want an >unknown< ID to show its product name? I’m a little confused. User#20279 0 — 6y
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 TheDoctor66880 2 — 6y

1 answer

Log in to vote
0
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
6 years ago

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

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 TheDoctor66880 2 — 6y
Ad

Answer this question