Is it possible to change a mesh's collision fidelity via script/command?

I have attempted to set a meshpart’s collision fidelity using the command prompt but it throws an error saying that “CollisionFidelity is not a valid member of MeshPart”. I have a ton of meshes that I want to change from default collision to box collision to improve performance in my game.

Here is the code I used that would give me the error:

for _,v in pairs(workspace:GetDescendants()) do
if v:IsA(“MeshPart”) then
v.CollisionFidelity = Enum.CollisionFidelity.Box
end

2 Likes

Whilst running a game it can’t be changed via script or manually in properties.

1 Like

I’m trying to do it in studio while the game is not running.

Then yes, this should work if you run it in the command bar.

https://gyazo.com/d0606cc453a1e4c8f45af677de5584e9
This is the error I am getting in the output

https://developer.roblox.com/en-us/api-reference/enum/CollisionFidelity

I don’t think you can set it actually.

Does this mean only for unions or for mesh parts too? The way it is worded on the forums made me think it would work for MeshParts but not unions.

I am pretty sure it will be the same for meshparts as it is for unions as the wiki seems to reference them both for this property.

It may be a case of someone hasn’t added meshpart to the note.

1 Like

That is unfortunate as I have a large amount of similar meshparts in my game. It is going to be tedious going through and setting all of their collision to box or hull because I’m trying to optimize performance.

Yes! You just need this little thing called a pcall to get around the security measure.

1 Like