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

Unable to assign property MeshId. Script write access is restricted - why is this?

Asked by 3 years ago

I got his error in the input while trying to run this script of a changing mesh.

local changingMesh = script.Parent

while true do 
    changingMesh.MeshId = "rbxassetid://6912495732"
    wait(2)
    changingMesh.MeshId = "rbxassetid://6912494739"
    wait(2)
end

Has anyone else had this happen to them?

2 answers

Log in to vote
0
Answered by 3 years ago

No, you cannot but according to this post on the DevForum, you can change a SpecialMesh id.

Ad
Log in to vote
0
Answered by 3 years ago

Assuming that changingMesh is MeshPart

Note that this property currently cannot be changed by scripts as the collision model of the mesh cannot be recomputed during runtime. Developers should not rely on this behavior as it may change in the future. Those looking for a custom mesh object that can be updated during runtime should use SpecialMesh. https://developer.roblox.com/en-us/api-reference/property/MeshPart/MeshID

  1. MeshID can't be changed by script due to the property of NotScriptable, the reason is shown above

NOTE: Don't confuse MeshId with MeshID, the 2 link is different but the result from search (MeshId) show BOTH MeshID and MeshId as MeshID, the detail of MeshId is empty when compared to MeshID

If the changingMesh is SpecialMesh then the MeshId can be changed, credit to co_existance

Link: https://developer.roblox.com/en-us/api-reference/property/FileMesh/MeshId

Answer this question