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

Getting the creator of an asset?

Asked by
nilVector 812 Moderation Voter
8 years ago

I know you can get the creator of a specific asset by using GetProductInfo() from the MarketplaceService. However, the specific Creator return value returns a table with a String and an Integer, not just a String. I need just the String value. Here are some of the methods I have tried to use:

NOTE: Variable "creator" is a StringValue object.

1)

local service = game:GetService("MarketplaceService")
creator.Value = service:GetProductInfo(1000000).Creator[1]

2)

local service = game:GetService("MarketplaceService")
local values = {}
values = service:GetProductInfo(1000000).Creator
creator.Value = values[1]

3)

local service = game:GetService("MarketplaceService")
local name, iDontNeed = service:GetProductInfo(1000000).Creator
creator.Value = name

For every single one of these methods, I have gotten this error: bad argument #3 to 'Value' (string expected, got nil)

Is there a way to get just the String from the table?

1 answer

Log in to vote
1
Answered by 8 years ago

The way to do this is as follows:

local service = game:GetService("MarketplaceService")
local info = service:GetProductInfo(1000000)
creator.Value = info.Creator.Name

I've never actually used MarketplaceService before; I'm just going by the wiki. Regardless, I hope this helps.

0
Wow! It was that simple? I'm facepalming so much right now. I guess I have a tendency to overthink things. Also, the fact that it said that it returned a table was what threw me off by a lot. Anyways, thanks! nilVector 812 — 8y
Ad

Answer this question