Help with Plugin

Hello! I am trying to make a plugin where you can create MeshParts and insert ID’s so it inserts them into the part when the part is created. However, I keep running into this problem that says, “Unable to assign property MeshId. Script write access is denied.” After that error, only a plain MeshPart comes out. I have no idea what this error is or does. If you guys can help, I would gladly appreciate it!

Server Script (inside GUI)

    local ChangeHistoryService = game:GetService("ChangeHistoryService")

script.Parent.Info.OnServerEvent:Connect(function()
	local meshPart = Instance.new("MeshPart")
	meshPart.Parent = game.Workspace
	
	print(script.Parent.MeshCustomizationFrame.MeshIDInserter.Text)
	print(script.Parent.MeshCustomizationFrame.TextureIDInserter.Text)
	
	meshPart.MeshId = "rbxassetid://"..script.Parent.MeshCustomizationFrame.MeshIDInserter.Text
	meshPart.TextureID = "rbxassetid://"..script.Parent.MeshCustomizationFrame.TextureIDInserter.Text
	
	script.Parent.RemoveGui:FireClient()
	
	ChangeHistoryService:SetWaypoint("Mesh-part has been created.")
end)

Local Script (inside Button)

 script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Parent.MeshCustomizationFrame.Visible = false
	script.Parent.Parent.Parent.Info:FireServer()
end)

local RE = script.Parent.Parent.Parent.RemoveGui

RE.OnClientEvent:Connect(function()
	script.Parent.Parent.Parent.MeshCustomizationFrame.MeshIDInserter.Text = ""
	script.Parent.Parent.Parent.MeshCustomizationFrame.TextureIDInserter.Text = ""
end)

Scripts are not able to change the MeshId property of a MeshPart. - MeshPart Reference
image
But, alternatively, you can change SpecialMesh id’s.

So, do I use Enum in scripts to get the Mesh and Texture ID’s to change? Or is it not possible at all to change a Mesh Id from a Script?

It’s not possible at all, roblox doesn’t allow scripts to do that for some reason, but I forgot to note and I just remembered: You can edit SpecialMeshes using a script.

So I can create a part, insert a SpecialMesh and edit that SpecialMesh?

Yes, you can do that. 30 karketrs

Thanks for helping me! It worked! Now I’m just gonna have to adjust the parts with the meshes.

1 Like