Modify MeshPart.MeshId through plugins/command bar


#1

As a developer, it’s currently painful to have to manually change MeshId for a large number of MeshParts at once. As an example, I have spent a bit over 3 hours changing 100 Special Meshes to MeshParts manually today, while I could have used that time to do other things for the game.

I understand that changing it at runtime has complications, however it’d be great if we are allowed to change them via plugins. If Roblox is able to address this issue, it would save us the time we need to spend manually setting our meshids and spend more time making other things for our games.


#2

Any news on this as its continuing to be a huge road block in development.


#3

Sorry to bump though now that realtime CSG is out is it any easier to get something like this to happen?


#4

So, I’m trying to figure out what you need exactly? You want to change:


This for a bunch of meshes all at once, right?

I’m just uncertain under what use case you’d need to change them via Plugin/Command Bar rather than just changing them by selecting all the Special Meshes in studio, and changing them by putting the code in. Idk, maybe I’m misunderstanding what you’re trying to do.


#5

This is for MeshParts – not SpecialMeshes. Command bar is needed because manually changing them takes too long. Using command bar to select and properties window to change may not be acceptable in the case that MeshId is calculated instead of all being set to the same.


#6

Ah, yea.
Couldn’t you name all the MeshParts like “Lamp” and run a while loop script that finds all the things called “Lamp” and changes their MeshID? I mean, you’d have to run the game, and then when you stop, it’d revert the changes, but you could grab all the meshes during play, and copy/paste them into edit mode.


#7

The issue here is that MeshPart.MeshId is tagged as NotAccessibleSecurity for ScriptWriteRestricted.

This means that any sort of script, be it a Script, LocalScript, CoreScript, Command Bar, etc. trying to edit the MeshId of the MeshPart will result in an error being thrown, and the property thus can’t be changed.

The purpose of this thread is to be able to efficiently change that property for a bunch of MeshParts that might be too tedious to do manually, as EchoReaper mentioned. This is currently not possible to do with any sort of script.


#8

You can somewhat work around this restriction by cloning the replacement meshpart from somewhere, and copying all the properties of the part you’re replacing.

However, this wouldn’t work for OP’s case as the meshpart instances don’t exist yet and are very varied. It’s disgusting to need to work around this in the first place. I ran into this issue recently and it was an utter waste of time to fight with.


#9

Also, to comment on the current issue with MeshPart.MeshId not being accessible for write, a current workaround could be to save the place / model as a .rbxlx or .rbxmx file (XML representation of the place / model), then via some external program scan traverse through the XML structure and identify the tags of
<Item class="MeshPart" referent="..."> containing the following two tags:

<Content name="MeshID"><url>rbxassetid://1234567890</url></Content>
<Content name="MeshId"><url>rbxassetid://1234567890</url></Content>

Which can then be replaced externally.

Of course though, this is a workaround and requires knowledge of traversing the XML structure and such, which could be easier to do with the ability to change the MeshId from Roblox :slightly_smiling_face: