Hello devforum,
On/off for the past few months, I’ve been attempting manipulate accessories and their meshes through scripts, however to no avail.
Attempted methods:
Loading accessory in separate parts
Directly editing Accessory.TextureId (it’s a read-only value.)
Loading texture seperately as a decal and then applying the loaded texture
Using EditableMesh
(I am yet to try with EditableImage)
Latest script (very bare bones because I haven’t spent a lot of time on the current version yet):
local AssetService = game:GetService("AssetService")
function insertAccessory()
local meshId = 123456789 -- replace with the asset ID of the mesh you want to load
warn("Function started")
-- Create an EditableMesh object
local editableMesh = AssetService:CreateEditableMeshAsync(meshId)
warn("Created editable mesh")
-- Create a new MeshPart object
local meshPart = Instance.new("MeshPart")
warn("Created meshpart")
-- Set the mesh and texture for the MeshPart
meshPart.MeshId = editableMesh.Id
meshPart.TextureId = 456789012 -- replace with the asset ID of the texture you want to load
warn("Set meshpart properties")
-- Parent the MeshPart to the workspace
meshPart.Parent = workspace
warn("Relocated meshpart")
-- Set the name and CFrame of the MeshPart
meshPart.Name = "Prototype"
meshPart.CFrame = workspace:WaitForChild("ghost").CFrame
warn("Finalised adjustments finished.")
end
If anyone has any possible solutions please reply.
I have tried asking multiple AI like the Assistant, ChatGPT and Gemini, all have failed.
Thanks in advance for your help.