I’m getting this error message while trying to Instance.new(“MeshPart”) and setting its MeshId Property. Why is this happening? is there no way to do this? or am i doing it wrong?
Unfortunately I don’t think ROBLOX has gotten around to allow scripts to set MeshID’s yet. I’ve looked around for this a couple of times and never been able to find a solution
According to the API Reference page for MeshPart.MeshID*, it’s not possible to set that property using a script.
*Apparently, there is no page for MeshId. That redirects to MeshID.
Edit: also, as you’ll note, the error says “Script write access is restricted”, which one can interpret to mean that the script cannot write to (make changes to) that property.
Here is a solution to this problem:
Instead of using a MeshPart, use a regular Part with a SpecialMesh inside it.
Apparently, the MeshId property of a SpecialMesh may be set using a script.
InsertService:CreateMeshPartAsync is now an available alternative, but for plugins only.
See post here for alternatives: Add the ability to instantiate meshes with a new MeshId during runtime - Feature Requests / Engine Features - Developer Forum | Roblox