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

MarketplaceService not returning an asset?

Asked by 5 years ago
Edited 5 years ago

Hey everyone, I don't know if this is because it is currently midnight or not but for some reason this is always returning nil even though when I tested it in the command bar it works fine.

And before anyone asks here is the asset: https://www.roblox.com/library/2007144377/Hawk-T2

function script.Parent.GetAsset.OnServerInvoke(id)
    local asset
    local success = pcall(function()
        asset = game:GetService("MarketplaceService"):GetProductInfo(id)
    end)
    if success then
        return asset
    end
    return nil
end

Custom Error: Unable to get asset from ID "2007144377"

Asset id checks out.

Thanks for the help to anyone that replies!

1 answer

Log in to vote
0
Answered by
thesit123 509 Moderation Voter
5 years ago

You need an equal sign after success.

0
Technically they don't. If success then is a fine code. It basically is: if success == true then. chexburger 358 — 5y
Ad

Answer this question