Is it possible to set a MeshPart to a MeshID through a script?

Hey, simple question.

Is it possible to set a MeshPart to a MeshID through a script? I’ve tried and it struck me with an error: Unable to assign property MeshId. Script write access is restricted

Thanks!

local RunService = game:GetService('RunService')

local RainSpawned = 0
local RainEnd = 3500
local RainSound = game.Workspace.Rain

local Thunder = 0
local ThunderSound = game.Workspace.Thunder
local ThunderSound2 = game.Workspace.Thunder2

while true do
	RainSound:Play()
	for i = 1, RainEnd do 
		
		local RandomNumber = math.random(1, 40) 
		local RandomNumber2 = math.random(1, 60)
		local RandomNumber3 = math.random(1, 40)
		RainSpawned = RainSpawned + 1
		wait()
		local Rain = Instance.new("MeshPart")
		Rain.MeshId = "rbxassetid://5171497068"
		Rain.Size = Vector3.new(0.329, 1.38, 0.329)
		Rain.Position = Vector3.new(RandomNumber, RandomNumber2, RandomNumber3)
		Rain.Anchored = false
		Rain.CanCollide = false
		Rain.Color = Color3.fromRGB(156, 182, 197)
		Rain.Parent = workspace.Droplets
		
		if (math.random(1, 250)) == 8 then
			local Thunder = Instance.new("Part")
			Thunder.Size = Vector3.new(0.2, 10, 0.2)
			Thunder.Position = Vector3.new(RandomNumber, RandomNumber2, RandomNumber3)
			Thunder.Anchored = false
			Thunder.CanCollide = false
			Thunder.Color = Color3.fromRGB(239, 184, 56)
			Thunder.Material = Enum.Material.Neon
			Thunder.Name = "ThunderLight"
			Thunder.Parent = workspace	
			local Light = Instance.new("PointLight")
			Light.Color = Color3.fromRGB(239, 184, 56)
			Light.Range = 10
			Light.Parent = game.Workspace.ThunderLight

			if (math.random(1, 2)) == 1 then
				ThunderSound:Play()
			elseif (math.random(1, 2)) == 2 then
				ThunderSound2:Play()
			end
		end
	end
	RainSound:Stop()
	wait(math.random(1, 100))
end
1 Like

Do you mean like changing the MeshID of a part through a script? If so it is possible, here’s a quick example:
Tool.Handle.Mesh.MeshId = “http://www.roblox.com/asset/?id=89987774

You can’t change a MeshPart id, but you can change a SpecialMesh id.

9 Likes

I just checked before attempting this myself. But you can use this plugin here to convert directories of meshes into mesh parts.
Mesh2Part - Creator Marketplace (roblox.com)