Troubles with writing MeshId using a server-side script

  1. I feel like the title explains itself.

  2. I am unable to write MeshId with a script

  3. I have only tried using InsertService to fix the problem but i only run into the problem of the restrictions of LoadAsset

ham=game.InsertService:LoadAsset(tonumber(m.MeshId:sub(14))).MeshPart

For more context this is involved with player’s accessories/hats

Here is the full function, i might provide full script if needed!

function hatcopy(hat)
	ha=hat:FindFirstChild("Handle")
	if ha then
		ha.CanCollide=true
		m=ha:FindFirstChildWhichIsA("SpecialMesh")
		if m then
			ham=Instance.new("MeshPart")
			ham.MeshId=m.MeshId
			ham.TextureID=m.TextureId
			wait()
			ham.Size=Vector3.new((ham.Size.X*m.Scale.X),(ham.Size.Y*m.Scale.Y),(ham.Size.Z*m.Scale.Z))
			ham.CFrame=ha.CFrame
			ham.Parent=workspace
			ham.Name=(hat.Name:lower()):gsub(" ","")
			game.Debris:AddItem(ham,20)
			hat:Destroy()
		else
			return
		end
	else
		return
	end
end

console screenshots if needed

with insertservice:
image
without:
image

ive also been told it only would work in localscript, can someone tell me if this is true or not?

1 Like

You can’t edit mesh ids with scripts.

1 Like