The current thread cannot write 'MeshId' (lacking capability NotAccessible)

Hello,

I’m trying to make a system that if you have enough ‘Chili’, you can turn muscular (suggesting that the body parts will change). But I wanted to test only the left foot, to not waste time. But I instead got the error in the title.

local morph = require(game.ReplicatedStorage.MorphScript)

script.Parent.OnServerEvent:Connect(function(plr)
	local char = plr.Character
	plr:WaitForChild("leaderstats").Chili.Value += 1
	
	while wait() do
		if plr:WaitForChild("leaderstats").Chili.Value >= 100 then
			char.LeftFoot.MeshId = morph.leftfoot.MeshId
		end
	end
end)

Is there a workaround that (is no too hard) can change the MeshId?

Thanks.

Please read documentation before making a post for help.

Note that the MeshId 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 a SpecialMesh.

yes i read that before this, i thought if i can just add a special mesh and delete the… mesh, when its supposed to do the morphing

You could just spawn in a new SpecialMesh with the MeshId you want, and weld it to the character.

If it clips with the character model in any way, you can make that underlying part in question invisible, so that only the SpecialMesh is visible.

1 Like