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

Help with GetAssetInfo?

When I do this

local Asset = game:GetService("MarketplaceService"):GetProductInfo(AssetHere)
for i,v in pairs(Asset) do
	print(i, " .. ",v)
end

And use an asset if of an audio asset that i own (uploaded)it will say 'Run time.." and then the time, When I do someone else id it won't say the same. Any way I can read a audio files length server side?

VVVV Print for a audio that I don't own (uploaded)

AssetTypeId  ..  3
IconImageAssetId  ..  0
IsNew  ..  false
Updated  ..  2016-01-17T00:35:59.107Z
IsLimitedUnique  ..  false
ProductId  ..  31191409
MinimumMembershipLevel  ..  0
Created  ..  2016-01-17T00:33:58.863Z
Creator  ..  table: 1F0F72E8
IsLimited  ..  false
ContentRatingTypeId  ..  0
AssetId  ..  344200738
IsPublicDomain  ..  true
Name  ..  The Chainsmokers - New York City
IsForSale  ..  false
Description  ..  Audio
Sales  ..  203

VVVV Print of an audio asset that I do own (uploaded)

AssetTypeId  ..  3
IconImageAssetId  ..  0
IsNew  ..  false
Updated  ..  2014-06-17T13:56:13.327Z
IsLimitedUnique  ..  false
ProductId  ..  20687188
MinimumMembershipLevel  ..  0
Created  ..  2014-06-17T11:49:32.17Z
Creator  ..  table: 10B50E28
IsLimited  ..  false
ContentRatingTypeId  ..  0
AssetId  ..  161817867
IsPublicDomain  ..  true
Name  ..  Like & Comment
IsForSale  ..  false
Description  ..  I'd be awesome if you could leave a like and a comment.
Run time 2.57 Seconds
Sales  ..  4

"Run time 2.57 Seconds" Prints on the asset I created but not the others, why? How can I read an audio files length Server side?

1 answer

You shouldn't

Just handle it on the client. The server will never load the sound, and never has to worry about things like the sound time length. If this causes issues for you, then it's because your game logic is wrong and you need to reconsider how you're managing those sounds.

3 comments

0

I have a sever side music board and I wanted to use a surface gui to display the time length of the song..

0

Do it on the client.

0

Okay. Sorry for wasting your time.

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