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

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Change MeshId from another MeshId

  2. What is the issue? Include screenshots / videos if possible!
    The current thread cannot write ‘MeshId’ (lacking capability NotAccessible)

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Devfourms and other community code / youtube

Code:

for i, b in pairs(PowerUpMainFrameUI.BackgroundImages:GetChildren()) do
			if b:FindFirstChild("MeshPart") then
				if effects.PowerUps:FindFirstChild(ability.Value) then
					warn("Ability Value")
					local newMeshPart = Instance.new("MeshPart")
					newMeshPart.MeshId = effects.PowerUps:FindFirstChild(ability.Value)
					newMeshPart.Parent = b.MeshPart
					--b.M
				else
					warn("No Ability Value")
				end
			end
		end

image

2 Likes

You can’t set the MeshId of a MeshPart during runtime. You’ll just have to store the mesh somewhere that the LocalScript can access it from.

4 Likes

If the MeshId is only known at runtime (i.e. the player must enter it), then you can use AssetService:CreateMeshPartAsync to create a new MeshPart, and MeshPart:ApplyMesh to apply the mesh to a pre-existing MeshPart.

Otherwise, use the method @Rinpix and store them somewhere statically.

5 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.