Hello, I’ve recently started implementing skinned meshes for my NPCs, and I’ve encountered a recurring issue. Each time I close and reopen the place file in Studio, I am no longer able to animate the NPCs. Upon investigating, I discovered that all of the Motor6D instances associated with the rigs are being duplicated automatically. Initially, I attempted to delete the duplicated Motor6Ds manually, but the number of copies was so large that Studio would crash during the process. To work around this, I wrote and used the following script in the studio command bar, which helped remove the duplicates, though it took over an hour to complete:
local npcFolder = workspace["VillageNPC's"]
if npcFolder then
for _, model in npcFolder:GetChildren() do
if model:IsA("Model") then
for _, part in model:GetDescendants() do
if part:IsA("MeshPart") then
local weldsSeen = {}
for _, child in part:GetChildren() do
task.wait()
if child:IsA("Motor6D") then
print("Found weld:", child:GetFullName())
if weldsSeen[child.Name] then
print("Destroying duplicate:", child:GetFullName())
child:Destroy()
else
weldsSeen[child.Name] = true
end
end
end
end
end
end
end
else
warn("workspace.VillageNPCs not found.")
end
The first time I encountered this issue, I had to delete about 60k Motor6Ds. Now, I haven’t experienced such a big number, and it is always just 2 when I open the studio (still 1 too many). After playing around a bit and coming back, it is now around 100.
The bug happened to me at these moments:
- Closing and re-opening the studio file
- Copying the NPC and changing their looks
(I put the file of the rigs with this issue inside of the staff-only content box)
A private message is associated with this bug report