MeshContentProvider Issue

In my game, I wanted to make a 3D Warehouse, basiclly a window where you can view parts and meshes. I ran into an issue.

I have a TextBox to load meshes in


code sample:

script.Parent.FocusLost:Connect(function()
game.SoundService.Click:Play()
script.Parent.Parent.Viewport.MainPart.Transparency = 1
script.Parent.Parent.Viewport.WedgePart.Transparency = 1
script.Parent.Parent.Viewport.CWedgePart.Transparency = 1
script.Parent.Parent.Viewport.TrussPart.Transparency = 1
script.Parent.Parent.Viewport.MeshPart.Transparency = 0
script.Parent.Parent.Viewport.MeshPart.Mesh.MeshId = “rbxassetid://”…script.Parent.Text
end)

But when i insert an ID this happens:


error:
MeshError

How would i fix this issue?
Any tips?

Its not the correct Id for the item. I looked it up on the catalog and got the item. When i put it in studio the meshpart had this Id instead

430072717
1 Like

Okay I see.
But a random player wouldnt be able to know this and wouldnt be able to put it on a meshpart since you cant do that with scripts.

That’s why you need to convert the catalogue id to an assetId yourself. You can feed the MeshPart id filled in by the user to MarketplaceService.GetProductInfo with InfoType Enum.InfoType.Asset, then extract the AssetId in the returned dictionary and apply that as the MeshPart MeshId.

2 Likes

This is what i did.
It just gives back the same ID

local num = script.Parent.Text
local info = game:GetService(“MarketplaceService”):GetProductInfo(num, Enum.InfoType.Asset)
local val = info.AssetId
print(val)
script.Parent.Parent.Viewport.MeshPart.Mesh.MeshId = “http://www.roblox.com/asset/?id=”…val

That’s… interesting. It’s not supposed to do that. Out of curiosity, are there any errors that get thrown while this function is ran? Do the server and the client return the same number that you fed into GetProductInfo as the AssetId?

here is the server/client
meshid

and here is what happens when i try to set the meshid to that id
error
there is no other errors

also just to clarify i want to do this ONLY on the client inside a viewport frame in a specialmesh

I find that to be fairly interesting. Either I’m not understanding the usage of GetProductInfo or it truly isn’t returning the correct thing.

Out of curiosity, mind iterating through the table and seeing if any of the values match the id that was found above as the AssetId?

local MarketplaceService = game:GetService("MarketplaceService")
local ProductInfo = MarketplaceService:GetProductInfo(430072734, Enum.InfoType.Asset)
local value = 430072717

local function matchToValue(array, findValue)
    for key, value in pairs(array) do
        if value == findValue then
            return key, value
        end
    end
    return nil, "N/A"
end

print(matchToValue(ProductInfo, value))

See if this prints anything other than nil and N/A. You can even add prints above the returns to print out the key and value to see if any of the match to the AssetId rather than the catalogue id.

Getting exam results, can’t test this myself.

The only other options I know are to use an external service (not reliable) and InsertService (can only insert items you own).

Always prints nil N/A i even tried changing the ids but still nil N/A

i even tried my own version of this script:

local MarketplaceService = game:GetService("MarketplaceService")
local ProductInfo = MarketplaceService:GetProductInfo(1484150498, Enum.InfoType.Asset)
local value = 1484150481

if ProductInfo.AssetId == value then
print("YAY")
else
print(ProductInfo.AssetId.." ~= "..value)
end

it always prints out the second thing

all of this could work only if you could change meshids for meshparts