Plugin:ImportModel()

As a Roblox plugin developer, it is currently impossible to to prompt the player to load an RBXM file into studio (like you can do in the ribbon bar at Model>Advanced>Model). My use case for this is in making a terrain saving/loading plugin, currently I can prompt the player to save a model using Plugin:PromptSaveSelection() but I have no way to allow players to browse for and select these saved models to load into a different place later.

Functionality like this already exists for FBX files with Plugin:ImportFbxRig() and Plugin:ImportFbxAnimation()

While on this topic; I think it would be worth adding this functionality for lua files as well, as PromptSaveSelection saves single scripts as lua files instead of RBXM files.

8 Likes

Hate to necro posts. But this is still relevant and necessary to add. Being able to save is great, but reloading assets is nearly impossible to do. It’d be really nice to be able to load in models via a similar function.

I made the attempt with StudioService:PromptImportFile({‘rbxm’, ‘rbxmx’}) but ran into issues where it imports as a File instead of the Instances saved.

2 Likes

fyi, you can actually import rbxm files using game:GetObjects()

local files = game:GetService("StudioService"):PromptImportFiles({"rbxm", "rbxmx"})
for _, file in files do 
   local id = file:GetTemporaryId() 
   game:GetObjects(id)[1].Parent = workspace 
end
4 Likes

Holy smokes you have changed everything. You are a phenomenal person. I wish nothing but good fortunate upon you and your descendants.